From c51068448f393f5a5d024bc41b704297113cf625 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sun, 5 Jul 2026 02:42:37 +0300 Subject: [PATCH] test: keep windows smoke cleanup non-fatal --- scripts/windows_smoke_conpty_path.ps1 | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/scripts/windows_smoke_conpty_path.ps1 b/scripts/windows_smoke_conpty_path.ps1 index 41f637fc..76229275 100644 --- a/scripts/windows_smoke_conpty_path.ps1 +++ b/scripts/windows_smoke_conpty_path.ps1 @@ -89,9 +89,15 @@ try { $deadline = (Get-Date).AddSeconds(15) do { Start-Sleep -Milliseconds 500 - $read = & $exe agent read smoke --source recent --lines 40 --format text 2>&1 + try { + $read = & $exe agent read smoke --source recent --lines 40 --format text 2>&1 + $readExitCode = $LASTEXITCODE + } catch { + $read = @($_.Exception.Message) + $readExitCode = 1 + } $text = $read -join "`n" - if ($LASTEXITCODE -eq 0 -and $text -match "File\(s\)" -and $text -match "Dir\(s\)") { + if ($readExitCode -eq 0 -and $text -match "File\(s\)" -and $text -match "Dir\(s\)") { break } } while ((Get-Date) -lt $deadline) @@ -101,9 +107,17 @@ try { } } finally { if ($null -ne $server) { - & $exe server stop 2>$null + try { + $stopOutput = & $exe server stop 2>&1 + if ($LASTEXITCODE -ne 0) { + Write-Host "server stop during cleanup exited with $LASTEXITCODE`: $($stopOutput -join "`n")" + } + } catch { + Write-Host "server stop during cleanup failed: $($_.Exception.Message)" + } Wait-Process -Id $server.Id -Timeout 10 -ErrorAction SilentlyContinue } + $global:LASTEXITCODE = 0 $env:PATH = $oldPath $env:HERDR_SESSION = $oldSession Remove-Item -Recurse -Force $fakeDir -ErrorAction SilentlyContinue