Skip to content

Bash tool executes bash commands with cmd.exe #4599

Closed

Description

@keathmilligan

Description

The bash tool frequently tries to run commands like mkdir -p ... using spawn, which on Window, defaults to using cmd.exe as the shell. This results in a directory called -p being created and subsequent commands failing.

OpenCode version

1.0.85

Steps to reproduce

  1. Run opencode on Windows.
  2. Issue a prompt like create the path "src/test".

Screenshot and/or share link

# Create src/test directory path
$ mkdir -p src/test
The syntax of the command is incorrect.

list the directory and note that a -p directory has been created.

Operating System

Windows 11

Terminal

Windows Terminal

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 21, 2025
  2. self-assigned this
    on Nov 21, 2025
  3. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 21, 2025
  4. rekram1-node commented on Nov 21, 2025

    @rekram1-node
    Contributor

    ill fix

  5. keathmilligan commented on Nov 21, 2025

    @keathmilligan
    ContributorAuthor

    Local hack I'm currently using:

    packages/opencode/src/tool/bash.ts:148

    const shell = process.platform === "win32" && process.env.SHELL?.includes("bash") ? process.env.SHELL : true
        const proc = spawn(params.command, {
          shell,
          ...
    
  6. rekram1-node commented on Nov 21, 2025

    @rekram1-node
    Contributor

    should be fixed on latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions