GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — fix(core): find Microsoft Store PowerShell 7 on Windows by Hona · Pull Request #61952 · anomalyco/opencode Conversation
|
| Call | lstat |
stat |
access |
Launches |
|---|---|---|---|---|
WindowsApps\…\pwsh.exe (Bun 1.4.4 and Node 26) |
symlink, 85 B | EACCES |
ok | 7.6.9 |
flowchart LR
A["which('pwsh')"] --> B{which@6}
B -- "stat EACCES: skipped" --> C["alias on PATH? (lstat symlink + exists)"]
C -- yes --> D["WindowsApps\…\pwsh.exe"]
B -- found --> D2[path]
| Shell resolution on a machine with Store PowerShell 7 | Before | After |
|---|---|---|
| Default (no config) | powershell.EXE 5.1 |
pwsh.exe 7 |
"shell": "pwsh" |
powershell.EXE 5.1 |
pwsh.exe 7 |
"shell": "…\WindowsApps\pwsh.exe" |
throws EACCES |
…\WindowsApps\pwsh.exe |
cross-spawn has the same which blind spot, so it still starts the alias through cmd.exe /d /s /c. Its argument escaping keeps %, &, |, ^, <>, ! and quotes intact.WindowsApps and skip where none exists.<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none" font-family="ui-monospace, monospace" font-size="11"> <style> .old { animation: old 4s infinite; } .new { animation: new 4s infinite; } @keyframes old { 0%, 40% { opacity: .9 } 50%, 100% { opacity: .15 } } @keyframes new { 0%, 40% { opacity: .15 } 50%, 100% { opacity: .9 } } @media (prefers-reduced-motion: reduce) { .old, .new { animation: none } .old { opacity: .15 } .new { opacity: .9 } } </style> <rect x="0.5" y="0.5" width="239" height="71" stroke="currentColor" stroke-opacity=".3"/> <text x="12" y="22" fill="currentColor" opacity=".6">which pwsh</text> <g class="old"><text x="12" y="42" fill="currentColor">PS 5.1</text><text x="12" y="58" fill="currentColor" opacity=".6">alias skipped</text></g> <path d="M100 46 h28 m-6 -5 l6 5 l-6 5" stroke="currentColor" stroke-opacity=".5"/> <g class="new"><text x="140" y="42" fill="currentColor">PS 7.6</text><text x="140" y="58" fill="currentColor" opacity=".6">alias found</text></g> </svg>
Added by the opencode bot (AI-generated).
Fixes #55255
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The change looks sound. I couldn't verify it at runtime because the bug needs Windows with PowerShell 7 installed from the Microsoft Store, and the sandbox runs Linux. Reading the code: the new PATH scan in which() only runs on Windows, for bare names, after which@6 finds nothing. In ShellSelect.executable(), the alias check comes before stat, so both the fallback to 5.1 and the EACCES thrown from stat (which #55255 reports crashing the session step) should be gone. The related which and shell tests pass here; the new alias tests are skipped on Linux.
Public API: unchanged. No config keys, CLI flags, SDK or HTTP API changes; it only changes how shells and executables are found on Windows.
No blocking concerns.
Fixes #55255
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Windows: pwsh installed as a Store app-execution alias is not resolved, so the shell falls back to Windows PowerShell 5.1
There was an error while loading. Please reload this page.