You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Opencode bash tool spawn user commands using /bin/sh what is not bash :-) #3479
**shell **- If true, runs command inside of a shell. Uses '/bin/sh' on Unix, and process.env.ComSpec on Windows. A different shell can be specified as a string.
I'm expecting from bash tools to execute at least bash, or default process.env.SHELL but sh feels pretty outdated for me.
Something like this feels more suitable (or check bash existance and use it if it exists in the PATH)
constdefaultShell=process.platform==="win32"
? true// process.env.ComSpec on Windows
: process.env.SHELL??true// $SHELL - *default shell for new sessions* if set, otherwise /bun/shconstproc=spawn(params.command,{// use the user's login shell (or sensible fallback) rather than the system /bin/sh defaultshell: defaultShell,cwd: Instance.directory,stdio: ["ignore","pipe","pipe"],detached: process.platform!=="win32",})
OpenCode version
0.15.18
Steps to reproduce
In opencode write following prompt
Run following bash command
pid=$$
echo "$(ps -p "$pid" -o comm=)"
The result is
/bin/sh on linux
Screenshot and/or share link
Share links doesn't work for me for unknown reason
Operating System
MacOs
Terminal
ITERM 2
Reacted by Bernat Pericàs, Simon Spiridonov and Pablo De Tezanos-Pinto
changed the title [-]Opencode bash tool spawn user commands using `/bin/sh` what is not bash!!!![/-][+]Opencode bash tool spawn user commands using `/bin/sh` what is not bash :-)[/+]on Oct 27, 2025
This issue might be a duplicate of existing issues. Please check:
PATH is not inherited from invoking shell #2202: PATH is not inherited from invoking shell - addresses the same underlying problem where OpenCode uses /bin/sh instead of respecting the user's shell environment
A tool is called literally "bash". When AI is calling it with bash code it often fails, because it prepares bash code, but it is being executed with sh.
Activity
[-]Opencode bash tool spawn user commands using `/bin/sh` what is not bash!!!![/-][+]Opencode bash tool spawn user commands using `/bin/sh` what is not bash :-)[/+]github-actions commentedon Oct 27, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
rekram1-node commentedon Oct 27, 2025
yeah this is good point
feat: use default shell on nix env (anomalyco#3479)
SamSpiri commentedon Nov 18, 2025
A tool is called literally "bash". When AI is calling it with bash code it often fails, because it prepares bash code, but it is being executed with sh.
LankyMoose commentedon Oct 6, 2026
windows user here - still not solved T.T