fix(server): prefer pwsh as the default Windows shell#1846
fix(server): prefer pwsh as the default Windows shell#1846adammansfield wants to merge 2 commits intopingdotgg:mainfrom
Conversation
- Do not rely on overriding ComSpec to allow user shell selection on Windows because tools require it to be cmd.exe. For example, setting ComSpec as pwsh.exe and launching T3 Code breaks the "Open" Visual Studio Code button as it no longer does anything when clicked. - Prefer pwsh.exe because it matches VS Code's default shell behavior on Windows when pwsh.exe (PowerShell 7) is available.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR changes the default Windows shell from cmd.exe to pwsh.exe (PowerShell Core), which is a runtime behavior change affecting all Windows users. While fallback logic exists, changing default user-facing behavior warrants human review. You can customize Macroscope's approvability policy. Learn more. |
What Changed
Prefer pwsh.exe as the default Windows shell, and do not rely on ComSpec to allow user shell selection on Windows.
Why
Do not rely on overriding ComSpec to allow user shell selection on Windows because many tools require it to be cmd.exe. For example, setting ComSpec as pwsh.exe and launching T3 Code breaks the "Open" Visual Studio Code button as it no longer does anything when clicked.
Prefer pwsh.exe because it matches Visual Studio Code's default shell behavior on Windows when pwsh.exe (PowerShell 7) is available.
UI Changes
No UI changes.
Checklist
Validation
bun fmtbun lintbun typecheckcd apps/server && bun run test -- src/terminal/Layers/Manager.test.ts -t "retries with fallback shells when preferred shell spawn fails"Note
Medium Risk
Changes the default and fallback shell selection on Windows, which can affect terminal startup behavior on systems without
pwsh.exeor with customComSpecusage.Overview
Windows terminal sessions now prefer PowerShell 7 (
pwsh.exe) by default.defaultShellResolverno longer usesComSpec, and Windows fallback candidate ordering is updated to trypwsh.exefirst, thenpowershell.exe, thenComSpec, thencmd.exe.Tests for shell-spawn retry behavior were updated to account for Windows command normalization differences and to accept
pwsh.exeas a valid fallback shell.Reviewed by Cursor Bugbot for commit bef34cc. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
[!NOTE]
Prefer
pwsh.exeas the default Windows shell in terminal managerdefaultShellResolverto returnpwsh.exeunconditionally on Windows, replacing the previous default ofComSpec/cmd.exe.resolveShellCandidatesfallback order on Windows to[requested, 'pwsh.exe', 'powershell.exe', ComSpec, 'cmd.exe'], prioritizingpwsh.exeahead ofcmd.exe.pwsh.exesession by default instead ofcmd.exe; systems without PowerShell Core installed will fall back topowershell.exethencmd.exe.Macroscope summarized bef34cc.