fix: fallback to exit(128+signum) when self-signal doesn't terminate#71
Open
tadjik1 wants to merge 1 commit into
Open
fix: fallback to exit(128+signum) when self-signal doesn't terminate#71tadjik1 wants to merge 1 commit into
tadjik1 wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discovered this while debugging CI where
nycwas 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 callsprocess.exit(128 + signum)after 2 seconds, using the conventional POSIX shell exit code for signal deaths