Skip to content

fix: forward wrapper shutdown signals to Next child - #502

Merged
agegr merged 2 commits into
agegr:mainfrom
NgoQuocViet2001:fix/forward-wrapper-signals
Aug 15, 2026
Merged

fix: forward wrapper shutdown signals to Next child#502
agegr merged 2 commits into
agegr:mainfrom
NgoQuocViet2001:fix/forward-wrapper-signals

Conversation

@NgoQuocViet2001

@NgoQuocViet2001 NgoQuocViet2001 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • forward SIGINT and SIGTERM from the pi-web wrapper to the spawned Next.js process
  • allow up to five seconds for graceful child shutdown
  • force-stop the child when shutdown times out or another termination signal arrives
  • preserve child exit codes and conventional exit statuses for known signals
  • cover signal escalation, timeout cleanup, listener cleanup, and exit statuses with regression tests

Validation

  • Ran: node --experimental-strip-types --test lib/process-lifecycle.test.mjs
  • Ran: npm test (560 tests passed)
  • Ran: npm run lint
  • Ran: node_modules/.bin/tsc --noEmit
  • Ran: npm run build
  • Ran: npm pack --dry-run --json
  • Checked: a Unix SIGTERM smoke test exits the wrapper with status 143 and leaves no child process
  • Checked: a long-lived HTTP stream is force-closed after the five-second grace period; the wrapper exits with status 137 and leaves no child process

Fixes #495

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kill on the pi-web wrapper PID leaves the Next.js server child running (orphaned, still serving on the port)

2 participants