From b3c74d6d32d5824105db20f24c0e9c7c40e2e476 Mon Sep 17 00:00:00 2001 From: yibo Date: Wed, 25 Mar 2026 18:23:02 +0800 Subject: [PATCH] improve: explicit port conflict detection in start.sh --- start.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/start.sh b/start.sh index 844a0ce..423a7a0 100755 --- a/start.sh +++ b/start.sh @@ -14,9 +14,16 @@ if [ ! -d "node_modules" ]; then exit 1 fi -# 杀掉旧进程 -lsof -ti:3000 | xargs kill -9 2>/dev/null || true -lsof -ti:5173 | xargs kill -9 2>/dev/null || true +# 检测并清理端口冲突 +for PORT in 3000 5173; do + PID=$(lsof -ti:$PORT 2>/dev/null || true) + if [ -n "$PID" ]; then + echo "⚠️ 端口 $PORT 被占用 (PID: $PID),正在释放..." + kill -9 $PID 2>/dev/null || true + sleep 0.5 + echo " ✅ 端口 $PORT 已释放" + fi +done # 启动后端 Agent Chat Server echo "🔌 启动 Agent Server (端口 3000)..." -- libgit2 0.21.4