From b6dd8edc5de9d02701051cb3b35ad956be1a3b47 Mon Sep 17 00:00:00 2001 From: oliver Date: Wed, 29 Apr 2026 01:20:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20gateway=20=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E8=84=9A=E6=9C=AC=E5=9C=A8=20PID=20=E5=B7=B2=E9=80=80?= =?UTF-8?q?=E5=87=BA=E5=9C=BA=E6=99=AF=E4=B8=8B=E7=9A=84=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=A1=A8=E7=8E=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 stop_gateway 的进程终止流程中先检测进程是否存在,避免误报 Failed to stop 警告,保留端口回退清理逻辑并让 stop_all 输出更稳定可读。 Made-with: Cursor --- runtime/operations/scripts/stop_gateway.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) 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