Merge pull request #2 from nmemmert/claude/test-coverage-analysis-R2olv

Run dev server in background with nohup so it survives terminal close
This commit is contained in:
nmemmert
2026-05-27 09:24:05 -04:00
committed by GitHub
2 changed files with 26 additions and 3 deletions
+2
View File
@@ -2,3 +2,5 @@ node_modules/
dist/ dist/
coverage/ coverage/
*.local *.local
.vite.pid
.vite.log
+24 -3
View File
@@ -60,8 +60,29 @@ else
fi fi
# ── Launch ──────────────────────────────────────────────────────────────────── # ── Launch ────────────────────────────────────────────────────────────────────
PID_FILE="$(dirname "$0")/.vite.pid"
LOG_FILE="$(dirname "$0")/.vite.log"
# Stop any previously started instance
if [ -f "$PID_FILE" ]; then
OLD_PID=$(cat "$PID_FILE")
if kill -0 "$OLD_PID" 2>/dev/null; then
echo "Stopping previous server (PID $OLD_PID)..."
kill "$OLD_PID"
sleep 1
fi
rm -f "$PID_FILE"
fi
echo "" echo ""
echo "Starting dev server on http://localhost:$PORT" echo "Starting dev server in the background on http://localhost:$PORT"
echo "(Press Ctrl+C to stop)" echo "Logs: $LOG_FILE"
echo "" echo ""
exec npx vite --port "$PORT" --host
nohup npx vite --port "$PORT" --host > "$LOG_FILE" 2>&1 &
echo $! > "$PID_FILE"
echo "Server PID: $(cat "$PID_FILE")"
echo ""
echo "To stop the server: kill \$(cat .vite.pid)"
echo "To view logs: tail -f .vite.log"