Skip to content

Conversation

@ibetitsmike
Copy link
Contributor

This fixes embedded terminal creation on Windows failing with:

  • Failed to spawn Local terminal: File not found:

Root cause was PTYService using process.env.SHELL ?? "/bin/bash" for local PTY sessions. On Windows this can be unset, invalid, or even present-but-empty (SHELL=""), which results in node-pty attempting to spawn an empty executable.

What changed

  • Added resolveLocalPtyShell() to pick a sane default shell per platform.
    • Windows: prefer Git Bash (if available), else pwshpowershellCOMSPEC/cmd.exe
    • Non-Windows: prefer non-empty SHELL, else /bin/zsh (macOS) or /bin/bash
  • PTYService local sessions now use the resolver and include args (e.g. --login -i for Git Bash).
  • Improved PTY spawn failures to include the attempted command/args/cwd/platform (and preserve the original error as cause).

Validation

  • bun test src/node/utils/main/resolveLocalPtyShell.test.ts
  • make static-check

Generated with mux • Model: openai:gpt-5.2 • Thinking: xhigh • Cost: $2.00

@ibetitsmike ibetitsmike force-pushed the mike/fix-windows-pty-shell branch from 5e8e543 to 143b91d Compare January 14, 2026 17:55
@ibetitsmike ibetitsmike added this pull request to the merge queue Jan 14, 2026
Merged via the queue into main with commit a0357dc Jan 14, 2026
21 checks passed
@ibetitsmike ibetitsmike deleted the mike/fix-windows-pty-shell branch January 14, 2026 20:31
ethanndickson pushed a commit that referenced this pull request Jan 15, 2026
This fixes embedded terminal creation on Windows failing with:

- `Failed to spawn Local terminal: File not found:`

Root cause was `PTYService` using `process.env.SHELL ?? "/bin/bash"` for
*local* PTY sessions. On Windows this can be unset, invalid, or even
present-but-empty (`SHELL=""`), which results in node-pty attempting to
spawn an empty executable.

### What changed
- Added `resolveLocalPtyShell()` to pick a sane default shell per
platform.
- Windows: prefer Git Bash (if available), else `pwsh` → `powershell` →
`COMSPEC`/`cmd.exe`
- Non-Windows: prefer non-empty `SHELL`, else `/bin/zsh` (macOS) or
`/bin/bash`
- `PTYService` local sessions now use the resolver and include args
(e.g. `--login -i` for Git Bash).
- Improved PTY spawn failures to include the attempted
command/args/cwd/platform (and preserve the original error as `cause`).

### Validation
- `bun test src/node/utils/main/resolveLocalPtyShell.test.ts`
- `make static-check`

---
_Generated with `mux` • Model: `openai:gpt-5.2` • Thinking: `xhigh` •
Cost: `$2.00`_
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