test: keep windows smoke cleanup non-fatal
This commit is contained in:
parent
6972909428
commit
c51068448f
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue