fix(scripts): add next-server to serve.sh cleanup trap (#1162)

The cleanup() trap kills "next dev" and "next start" but not
"next-server". Since "next start" forks a "next-server" child
process, killing the parent may leave the child running as a
zombie, holding port 3000. The startup teardown block (line 35)
already handles this, but the Ctrl+C / SIGTERM trap did not.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
Karesansui
2026-03-17 11:07:16 +09:00
committed by GitHub
parent 9809af1f26
commit 75c96300cf

View File

@@ -92,6 +92,7 @@ cleanup() {
pkill -f "uvicorn app.gateway.app:app" 2>/dev/null || true pkill -f "uvicorn app.gateway.app:app" 2>/dev/null || true
pkill -f "next dev" 2>/dev/null || true pkill -f "next dev" 2>/dev/null || true
pkill -f "next start" 2>/dev/null || true pkill -f "next start" 2>/dev/null || true
pkill -f "next-server" 2>/dev/null || true
# Kill nginx using the captured PID first (most reliable), # Kill nginx using the captured PID first (most reliable),
# then fall back to pkill/killall for any stray nginx workers. # then fall back to pkill/killall for any stray nginx workers.
if [ -n "${NGINX_PID:-}" ] && kill -0 "$NGINX_PID" 2>/dev/null; then if [ -n "${NGINX_PID:-}" ] && kill -0 "$NGINX_PID" 2>/dev/null; then