Skip to content

fix: fallback to exit(128+signum) when self-signal doesn't terminate#71

Open
tadjik1 wants to merge 1 commit into
tapjs:mainfrom
tadjik1:main
Open

fix: fallback to exit(128+signum) when self-signal doesn't terminate#71
tadjik1 wants to merge 1 commit into
tapjs:mainfrom
tadjik1:main

Conversation

@tadjik1
Copy link
Copy Markdown

@tadjik1 tadjik1 commented Mar 5, 2026

Discovered this while debugging CI where nyc was used; tests were green on Linux but red on Windows, because on Linux the parent was silently swallowing the signal death and exiting 0, masking the actual failure. Windows doesn't have POSIX signals at all, so it surfaced the problem differently.

The fix is to replace the empty setTimeout(() => {}, 2000) "keepalive" with a fallback that calls process.exit(128 + signum) after 2 seconds, using the conventional POSIX shell exit code for signal deaths

When a child process dies from a signal (e.g. SIGABRT), foreground-child
re-raises the signal on itself via process.kill(process.pid, signal).
On some platforms (notably Linux), Node.js may catch the signal internally
and not terminate, causing the parent to exit cleanly with code 0 instead
of propagating the child's failure.
Replace the empty setTimeout keepalive callback with a fallback that calls
process.exit(128 + signalNumber) after 2 seconds, using the conventional
POSIX shell exit code for signal deaths.
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.

1 participant