diff --git a/runtime/operations/scripts/stop_gateway.ps1 b/runtime/operations/scripts/stop_gateway.ps1 index 4f7f39f5..cf088fd6 100644 --- a/runtime/operations/scripts/stop_gateway.ps1 +++ b/runtime/operations/scripts/stop_gateway.ps1 @@ -14,6 +14,16 @@ function Warn([string]$msg) { } function Kill-ProcId([int]$procId) { + $exists = $null + try { + $exists = Get-Process -Id $procId -ErrorAction SilentlyContinue + } catch { + $exists = $null + } + if (-not $exists) { + Write-Host "PID=$procId already exited" -ForegroundColor DarkGray + return $true + } try { Stop-Process -Id $procId -Force Write-Host "Stopped PID=$procId" -ForegroundColor Green