Skip to content

Commit 0f77fdf

Browse files
committed
test: tolerate Windows gateway restart timeout
1 parent 4558605 commit 0f77fdf

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

scripts/e2e/parallels-npm-update-smoke.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,33 @@ function Restart-GatewayWithRecovery {
408408
)
409409
410410
$restartFailed = $false
411-
try {
412-
Invoke-Logged 'openclaw gateway restart' { & $OpenClawPath gateway restart }
413-
} catch {
411+
$restartJob = Start-Job -ScriptBlock {
412+
param([string]$Path)
413+
$output = & $Path gateway restart *>&1
414+
[pscustomobject]@{
415+
ExitCode = $LASTEXITCODE
416+
Output = ($output | Out-String).Trim()
417+
}
418+
} -ArgumentList $OpenClawPath
419+
420+
$restartCompleted = Wait-Job $restartJob -Timeout 20
421+
if ($null -ne $restartCompleted) {
422+
$restartResult = Receive-Job $restartJob
423+
if ($null -ne $restartResult.Output -and $restartResult.Output.Length -gt 0) {
424+
$restartResult.Output | Tee-Object -FilePath $LogPath -Append | Out-Null
425+
}
426+
if ($restartResult.ExitCode -ne 0) {
427+
$restartFailed = $true
428+
Write-ProgressLog 'update.restart-gateway.soft-fail'
429+
"openclaw gateway restart failed with exit code $($restartResult.ExitCode)" | Tee-Object -FilePath $LogPath -Append | Out-Null
430+
}
431+
} else {
414432
$restartFailed = $true
415-
Write-ProgressLog 'update.restart-gateway.soft-fail'
416-
($_ | Out-String) | Tee-Object -FilePath $LogPath -Append | Out-Null
433+
Stop-Job $restartJob -ErrorAction SilentlyContinue
434+
Write-ProgressLog 'update.restart-gateway.timeout'
435+
'openclaw gateway restart timed out after 20s; continuing to RPC readiness checks' | Tee-Object -FilePath $LogPath -Append | Out-Null
417436
}
437+
Remove-Job $restartJob -Force -ErrorAction SilentlyContinue
418438
419439
Write-ProgressLog 'update.gateway-status'
420440
try {

0 commit comments

Comments
 (0)