@@ -11,6 +11,15 @@ BIN="${ROOT}/build/lidar_manager_web"
|
||||
DATA_DIR="$(mktemp -d)"
|
||||
SERVER_PID=""
|
||||
|
||||
# Dọn server test cũ trên cùng port (nếu còn).
|
||||
if command -v fuser >/dev/null 2>&1; then
|
||||
fuser -k "${PORT}/tcp" 2>/dev/null || true
|
||||
elif command -v lsof >/dev/null 2>&1; then
|
||||
PIDS="$(lsof -ti "tcp:${PORT}" 2>/dev/null || true)"
|
||||
[[ -n "$PIDS" ]] && kill $PIDS 2>/dev/null || true
|
||||
fi
|
||||
sleep 0.2
|
||||
|
||||
cleanup() {
|
||||
if [[ -n "$SERVER_PID" ]] && kill -0 "$SERVER_PID" 2>/dev/null; then
|
||||
kill "$SERVER_PID" 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user