mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 01:50:44 +08:00
优化 gateway 停止脚本在 PID 已退出场景下的日志表现。
在 stop_gateway 的进程终止流程中先检测进程是否存在,避免误报 Failed to stop 警告,保留端口回退清理逻辑并让 stop_all 输出更稳定可读。 Made-with: Cursor
This commit is contained in:
parent
26562b1ca4
commit
b6dd8edc5d
1 changed files with 10 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue