From 38898a3c21dab722b29ea9ab1374b6b1aa664e89 Mon Sep 17 00:00:00 2001 From: Simone Date: Thu, 14 May 2026 22:50:29 +0200 Subject: [PATCH] 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. --- .gitea/workflows/lint.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index b205ff8..caf3b0e 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -87,10 +87,20 @@ 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) { - & $venvPy --version 2>&1 | Out-Null - if ($LASTEXITCODE -eq 0) { $venvOk = $true } + 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) {