fix(server): prefer pwsh as the default Windows shell#1846
fix(server): prefer pwsh as the default Windows shell#1846adammansfield wants to merge 4 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 Windows terminal spawn defaults and fallback order, which can affect startup behavior on systems without PowerShell 7 or with unusual shell setups; non-Windows behavior is unchanged.
Overview
Windows terminal sessions now prefer
pwsh.exeby default.defaultShellResolverno longer usesComSpec/cmd.exe, and the Windows fallback list is reordered to trypwsh.exethenpowershell.exebefore falling back toComSpecandcmd.exe.Tests were updated to reflect the new Windows behavior, including allowing
pwsh.exeas a valid fallback and accounting for Windows command normalization differences.Reviewed by Cursor Bugbot for commit 4bc221f. 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 4bc221f.