fix(install): resolve PowerShell host instead of bare powershell for uv install#48341
Merged
kshitijk4poor merged 2 commits intoJun 18, 2026
Conversation
…r uv The Windows installer's Install-Uv spawned the astral uv installer with a hardcoded bare `powershell -ExecutionPolicy ByPass -c "irm .../uv | iex"`. That name resolves only to Windows PowerShell, and only when its System32 directory is on PATH. Run under PowerShell 7+ (`pwsh`) — or any session where `powershell` isn't on PATH — the spawn dies with "The term 'powershell' is not recognized", and uv installation aborts (the installer then appears stuck). Add Get-PowerShellHostExe, which prefers the absolute path of the host we're already running in (PATH-independent), then falls back to powershell/pwsh via Get-Command, then to the bare name. Install-Uv now invokes that resolved exe.
Source-level guard (install.ps1 only runs on Windows, so there's no Linux CI runner to execute it): the astral uv install line must be invoked via the call operator on a resolved host variable, the bare-`powershell` literal that produced the field-reported "The term 'powershell' is not recognized" must be gone, and the resolver must be PATH-independent (Get-Process -Id $PID) and pwsh-aware.
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
A Windows user reported the installer getting stuck; running
irm https://hermes-agent.nousresearch.com/install.ps1 | iexfailed at the uvstep with:
Root cause.
Install-Uvspawned the astral uv installer with a hardcodedbare
powershell:The bare name
powershellresolves only to Windows PowerShell, and onlywhen its
System32\WindowsPowerShell\v1.0directory is onPATH. Wheninstall.ps1is run under PowerShell 7+ (pwsh) — or any session wherepowershellisn't onPATH— the spawn dies with "The term 'powershell' isnot recognized", so uv never installs and the installer appears stuck. The
script already documents that it can be invoked from "any x64 PowerShell host"
(see the
Get-WindowsArchnote), so assumingpowershellis onPATHis theinconsistency.
Fix
Add
Get-PowerShellHostExe, which resolves the host executable in priorityorder:
(
(Get-Process -Id $PID).Path) — PATH-independent, and matches thehost the user actually launched (
powershell.exeorpwsh.exe);powershell/pwshviaGet-Command;powershellso the spawn surfaces its own error.Install-Uvnow invokes the resolved exe (& $psHostExe -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"). The host filter onlytrusts a current host whose leaf name is
powershell.exe/pwsh.exe, sopowershell_ise.exeand other embedded hosts (which can't take-ExecutionPolicy/-Command) fall through toGet-Command.This is the only external
powershellspawn in the script; the cross-processstage driver lives in
Hermes-Setup.exe, not here.Test plan
tests/test_install_ps1_uv_powershell_host.py(new) — source-level guards(the script only runs on Windows, so there's no Linux CI runner to execute
it): the bare-
powershellastral literal is gone, the installer is invokedvia
& $-resolved host variable, and the resolver is PATH-independent(
Get-Process -Id $PID) andpwsh-aware.scripts/run_tests.sh tests/test_install_ps1_uv_powershell_host.py— 3 passed.