chore(dev): stop.bat 仅 ASCII,避免 Windows GBK 乱码断行

cmd 按 ANSI 解析 .bat,中文提示改由带 BOM 的 stop.ps1 输出。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-16 07:44:26 +08:00
parent c6fdbb7193
commit d032668c66
3 changed files with 20 additions and 11 deletions

View File

@@ -1,11 +1,15 @@
# 按 Listen 端口终止进程树(含子进程)。默认 :3000 前端 / :3001 后端。
# 由 stop.bat 调用;也可直接:powershell -File stop.ps1
# Kill process trees listening on given ports. Default: :3000 frontend / :3001 backend.
# Called by stop.bat; or: powershell -File stop.ps1
param(
[int[]]$Ports = @(3000, 3001)
)
$ErrorActionPreference = 'SilentlyContinue'
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
Write-Host "Stopping listeners on :3000 / :3001 (process trees)..."
Write-Host ""
foreach ($port in $Ports) {
$pids = @(
@@ -13,12 +17,15 @@ foreach ($port in $Ports) {
Select-Object -ExpandProperty OwningProcess -Unique
)
if (-not $pids -or $pids.Count -eq 0) {
Write-Host " :$port 空闲"
Write-Host " :$port idle"
continue
}
foreach ($procId in $pids) {
if ($procId -le 0) { continue }
Write-Host " :$port -> PID $procId (含子进程)"
Write-Host " :$port -> PID $procId (tree)"
& taskkill.exe /T /F /PID $procId | Out-Null
}
}
Write-Host ""
Write-Host "Port cleanup finished."