Skip to content

fix(windows): resolve powershell.exe by absolute path so Desktop install doesn't stall at 0 of 0 steps - #40927

Merged
teknium1 merged 3 commits into
mainfrom
hermes/hermes-04c07ec4
Jun 7, 2026
Merged

fix(windows): resolve powershell.exe by absolute path so Desktop install doesn't stall at 0 of 0 steps#40927
teknium1 merged 3 commits into
mainfrom
hermes/hermes-04c07ec4

Conversation

@teknium1

@teknium1 teknium1 commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

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.exe trusts PATH to contain %SystemRoot%\System32\WindowsPowerShell\v1.0. When PATH is trimmed, truncated, or stored as a non-expanding REG_SZ (so %SystemRoot% never expands), the spawn dies with "program not found"/ENOENT before install.ps1 runs — the misleading error reads as if the .ps1 itself 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%/windirSystem32\WindowsPowerShell\v1.0\powershell.exe), then PATH (powershell.exepwsh.exe via the which crate), then bare name. Spawn-failure context now names the resolved interpreter.
  • apps/desktop/electron/bootstrap-runner.cjs: same absolute-path-first resolution in spawnPowerShell (the JS twin had the identical bare-name bug). Dependency-free — fs.statSync + PATH scan.
  • Cross-platform unit test for the System32\WindowsPowerShell\v1.0 path layout (@xxxigm).

Validation

Before After
Trimmed/REG_SZ PATH, healthy Windows stalls at "0 of 0 steps" resolves via %SystemRoot% absolute path
Healthy PATH works works (no behavior change)
Rust layout test passes (verified in isolation; full crate needs Tauri/dbus, not buildable on CI-free Linux box)
Electron resolver 4 branches E2E-verified on Linux: SystemRoot-first, PATH-fallback, last-resort, layout

Reproduces and fixes the Discord report exactly — where.exe powershell returned 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

resolve-powershell-absolute-path

xxxigm and others added 3 commits June 6, 2026 19:31
…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.
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-04c07ec4 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9969 on HEAD, 9969 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5171 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels Jun 7, 2026
@teknium1
teknium1 merged commit 210f4e7 into main Jun 7, 2026
20 checks passed
@teknium1
teknium1 deleted the hermes/hermes-04c07ec4 branch June 7, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants