ci(lint): fix broken-venv probe (AGENTS.md #12 stderr trap)
Native stderr from a broken python.exe shim ('No Python at ...') becomes a terminating exception under \Continue='Stop' BEFORE \0 can be read. Wrap the probe in try/catch + SilentlyContinue.
This commit is contained in:
@@ -87,11 +87,21 @@ jobs:
|
||||
# does NOT have plain "python" in PATH, but py.exe is installed system-wide.
|
||||
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
|
||||
|
||||
# Probe: a broken venv (pyvenv.cfg pointing to a deleted base interpreter)
|
||||
# writes "No Python at ..." to stderr; under $ErrorActionPreference='Stop'
|
||||
# native stderr becomes a terminating exception (AGENTS.md error #12),
|
||||
# so probe with SilentlyContinue + try/catch.
|
||||
$venvOk = $false
|
||||
if (Test-Path $venvPy) {
|
||||
try {
|
||||
$prevEAP = $ErrorActionPreference
|
||||
$ErrorActionPreference = 'SilentlyContinue'
|
||||
& $venvPy --version 2>&1 | Out-Null
|
||||
if ($LASTEXITCODE -eq 0) { $venvOk = $true }
|
||||
}
|
||||
catch { $venvOk = $false }
|
||||
finally { $ErrorActionPreference = $prevEAP }
|
||||
}
|
||||
|
||||
if (-not $venvOk) {
|
||||
Write-Host "Venv missing or broken, (re)bootstrapping at $env:VENV_DIR"
|
||||
|
||||
Reference in New Issue
Block a user