File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments