mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-21 10:22:18 +00:00
fix(install): fail fast when uv venv genuinely fails under relaxed EAP
PR #48372 relaxes EAP=Stop around the uv venv call so PowerShell 5.1 doesn't mistake uv's 'Using CPython ...' stderr for a terminating NativeCommandError. But relaxing EAP also means a *genuine* uv venv failure (exit != 0) no longer aborts on its own — Install-Venv would continue and print 'Virtual environment ready', and in stage mode Invoke-Stage would report ok=true, even though no venv was created. Capture $LASTEXITCODE immediately after the relaxed call and throw on non-zero (Pop-Location first, matching the function's other exit paths), so the venv stage fails fast instead of falsely succeeding. This is the explicit guard originally proposed in #48463 (devorun), composed on top of #48372's reusable helper + regression test. Adds a regression test asserting the uv venv exit-code capture + throw.
This commit is contained in:
parent
67316fdc94
commit
fd12e59e6b
2 changed files with 34 additions and 0 deletions
|
|
@ -1460,6 +1460,15 @@ function Install-Venv {
|
|||
# PowerShell 5.1 with EAP=Stop that stderr is a NativeCommandError unless
|
||||
# we temporarily relax EAP and trust $LASTEXITCODE for real failures.
|
||||
Invoke-NativeWithRelaxedErrorAction { & $UvCmd venv venv --python $PythonVersion }
|
||||
# Relaxing EAP above means a *genuine* uv-venv failure (exit != 0) no longer
|
||||
# aborts on its own. Capture $LASTEXITCODE immediately and fail fast, so the
|
||||
# `venv` stage can't falsely report success (and Invoke-Stage can't emit
|
||||
# ok=true) when the venv was never created.
|
||||
$venvExitCode = $LASTEXITCODE
|
||||
if ($venvExitCode -ne 0) {
|
||||
Pop-Location
|
||||
throw "Failed to create virtual environment (uv venv exited with $venvExitCode)"
|
||||
}
|
||||
|
||||
# Neutralize any inherited UV_PYTHON (e.g. $env:UV_PYTHON = "3.14" left in
|
||||
# the user's shell). uv honours UV_PYTHON over an existing venv for the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue