Skip to content

Conversation

@nielpattin
Copy link

On Windows, when SHELL env was set (e.g., to Git Bash), LLM-executed bash commands and user shell commands would ignore it and use cmd.exe instead.

Changes:

  • Strip Windows executable extensions (.exe/.cmd/.bat) from shell name
    detection so bash.exe is correctly matched to bash invocation rules
  • Explicitly pass SHELL env to spawn() on Windows instead of relying on
    shell: true which defaults to cmd.exe
  • This restores support for Git Bash and other POSIX shells on Windows

Tested with nushell and bash.exe from Git For Windows

Required for user that using Git Bash:

  • Set SHELL env to C:\Program Files\Git\usr\bin\bash.exe
  • C:\Program Files\Git\usr\bin need to be in path so the bash can use others linux utilities command.

Here is the video of using with Git Bash

gitbash-test.mp4

Here is the video of using with Nushell

nushell-test.mp4

@nielpattin nielpattin marked this pull request as draft November 2, 2025 05:26
@nielpattin nielpattin changed the title fix: respect SHELL environment variable on Windows for bash commands [WIP] fix: respect SHELL environment variable on Windows for bash commands Nov 2, 2025
@nielpattin nielpattin closed this Nov 4, 2025
@nielpattin nielpattin deleted the fix-windows-shell branch November 4, 2025 02:50
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.

1 participant