From 3971f8dc19be2d9d903fe94f97094e90632b58eb Mon Sep 17 00:00:00 2001 From: repair-agent Date: Mon, 2 Mar 2026 15:58:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20restart.sh=20=E6=94=B9=E7=94=A8=20kill?= =?UTF-8?q?=20-9=20=E5=BC=BA=E6=9D=80=E5=B9=B6=E7=AD=89=E5=BE=85=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E9=87=8A=E6=94=BE=E5=90=8E=E5=86=8D=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- airhub_app/restart.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/airhub_app/restart.sh b/airhub_app/restart.sh index 0c395bf..476e328 100755 --- a/airhub_app/restart.sh +++ b/airhub_app/restart.sh @@ -1,12 +1,16 @@ #!/bin/bash # 重新编译并启动 Flutter Web (localhost:8080) -# 杀掉占用 8080 端口的进程 +# 杀掉占用 8080 端口的进程(强制) PID=$(lsof -ti:8080 2>/dev/null) if [ -n "$PID" ]; then - echo "正在停止旧进程 (PID: $PID)..." - kill $PID 2>/dev/null - sleep 1 + echo "正在强制停止旧进程 (PID: $PID)..." + kill -9 $PID 2>/dev/null + # 等待端口真正释放(最多 5 秒) + for i in $(seq 1 10); do + lsof -ti:8080 > /dev/null 2>&1 || break + sleep 0.5 + done fi echo "正在编译并启动 Flutter Web..."