Skip to content

Conversation

@istarkov
Copy link
Contributor

@istarkov istarkov commented Oct 28, 2025

For spawn:

  • Nothing changes for windows users.
  • Uses $SHELL env variable - default shell for new sessions if set, othewise fallback on previous /bin/sh behaviour

Fixes #3479

@istarkov istarkov changed the title feat: Use default shell on Unix environments fix: Use default shell on Unix environments Oct 28, 2025
@istarkov istarkov changed the title fix: Use default shell on Unix environments fix: Use default shell to execute bash commands on Unix environments Oct 28, 2025
@veracioux
Copy link
Contributor

veracioux commented Oct 28, 2025

@istarkov @rekram1-node I feel like we should update the system prompt or tool description to tell the LLM what shell will be used. Especially for windows. The tool is called bash after all.

@istarkov
Copy link
Contributor Author

istarkov commented Oct 28, 2025

@istarkov @rekram1-node I feel like we should update the system prompt or tool description to tell the LLM what shell will be used. Especially for windows. The tool is called bash after all.

Probably here

` Platform: ${process.platform}`,

const shellName = (process.env.SHELL || process.env.COMSPEC || (process.platform === 'win32' ? 'cmd.exe' : 'sh'))
  .split(/[\\/]/).pop();
...

Platform: ${process.platform}, Shell: ${shellName}

But I would not touch this until real windows users have reproducible issues, as probably Platform is enough

@rekram1-node
Copy link
Collaborator

Yeah I need to setup a windows environment to test this more and I need to analyze how other tools do it.

the tool name being bash yeah it is confusing for the llm almost certainly

I think we can addresss that separately tho I want to do more investigation before just changing prompts

@istarkov
Copy link
Contributor Author

I have feeling that at the end it will be running bash in some container env. For reasons like prevent any operation out of project folder etc.

@rekram1-node
Copy link
Collaborator

rekram1-node commented Oct 28, 2025

@istarkov for those who use things like nunshell or fish, I wonder if this change could actually make their experience worse

We could just also try a check if they have bash installed and use that, but i suppose using the users shell offers some benefits and then it does come back to tool descriptions & names

This looks good, I will merge soon just wanna think more about how we can best serve everyone

@rekram1-node
Copy link
Collaborator

Given the tool is called bash, almost all unix users have bash, and a lot of windows users have git bash, and the prompts are all about bash, should we just do shell: "bash" if bash is installed? I feel like that's the safest bet here

@istarkov
Copy link
Contributor Author

istarkov commented Oct 31, 2025

I have few reasons why current approach is better:

    1. Default bash on mac is outdated and usually need to be changed with GNU bash
      Default shell on mac - zsh is modern and more compatible with GNU bash vs the default mac bash.
    1. As a developer I usually check issues with my current terminal and shell, and this is tool for developers ;-)

macOS /bin/bash (3.2) 2007 (18+ years old) ;-)

@rekram1-node
Copy link
Collaborator

i tend to agree, im just cautious, lemme test something with fish and nushell

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opencode bash tool spawn user commands using /bin/sh what is not bash :-)

4 participants