fix(windows): resolve powershell.exe by absolute path so Desktop install doesn't stall at 0 of 0 steps - #40927
Merged
Merged
Conversation
…Windows The native Windows installer spawned PowerShell via the bare program name `powershell.exe`, which trusts PATH to contain %SystemRoot%\System32\WindowsPowerShell\v1.0. On machines whose PATH was trimmed or truncated (Windows silently drops entries once the variable exceeds its length limit), the lookup fails and the spawn dies with "program not found" before install.ps1 runs at all — the installer then stalls at "0 of 0 steps". Resolve PowerShell by absolute path first (%SystemRoot%/%windir%), then fall back to PATH (powershell 5.1, then pwsh 7), then a bare name as a last resort. Also include the resolved interpreter in the spawn-failure context; the old message printed only the script path, which misleadingly read as if the .ps1 itself was missing.
Make `powershell_under_root` visible under `cfg(test)` so the %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe layout is asserted on any host (the rest of the resolution is gated to Windows).
…tstrap Mirror the bootstrap-installer (Rust) fix in the Electron first-launch runner. spawnPowerShell launched bare 'powershell.exe', trusting PATH to contain %SystemRoot%\System32\WindowsPowerShell\v1.0 — the same latent weakness that stalled the native installer at "0 of 0 steps" when PATH is trimmed/truncated or stored as a non-expanding REG_SZ. Resolve by absolute path first (%SystemRoot%/%windir%), then PATH (powershell 5.1 -> pwsh 7), then bare name as last resort.
Contributor
🔎 Lint report:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Native Windows installs no longer stall at "0 of 0 steps" when PATH can't resolve
powershell.exe. Both the Rust installer and the Electron first-launch runner now resolve PowerShell by absolute path before trusting PATH.Root cause: spawning bare
powershell.exetrusts PATH to contain%SystemRoot%\System32\WindowsPowerShell\v1.0. When PATH is trimmed, truncated, or stored as a non-expandingREG_SZ(so%SystemRoot%never expands), the spawn dies with "program not found"/ENOENT beforeinstall.ps1runs — the misleading error reads as if the.ps1itself were missing.Salvage of #40586 by @xxxigm onto current main, plus the Electron sibling fix.
Changes
apps/bootstrap-installer/src-tauri/src/powershell.rs(@xxxigm): resolve PowerShell by absolute path (%SystemRoot%/windir→System32\WindowsPowerShell\v1.0\powershell.exe), then PATH (powershell.exe→pwsh.exevia thewhichcrate), then bare name. Spawn-failure context now names the resolved interpreter.apps/desktop/electron/bootstrap-runner.cjs: same absolute-path-first resolution inspawnPowerShell(the JS twin had the identical bare-name bug). Dependency-free —fs.statSync+ PATH scan.System32\WindowsPowerShell\v1.0path layout (@xxxigm).Validation
%SystemRoot%absolute pathReproduces and fixes the Discord report exactly —
where.exe powershellreturned empty even from inside a PS window; the manual%SystemRoot%-absolute PATH addition fixed it. This makes that fix automatic.Original PR: #40586. Authorship preserved via cherry-pick (rebase merge).
Infographic