-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't test signal handling #10374
Comments
Something that I'm seeing is that That's set up in this So maybe jest is doing something odd with threads? On the other hand, when I log |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
I want to be able to test my code's signal handling by registering a handle with
process.on('SIGINT')
andprocess.kill(process.pid, 'SIGINT')
but it kills my jest process. (Or using a signal like SIGUSR1 shows that the signal is ignored.)To Reproduce
I made a gist that reproduces the behavior. I am testing on a Mac with Node v14.10. Note that using
console.log
doesn't work due to the process crashing early, so I'm "logging" via appendFileSync to /tmp/test.out and mytest
script clears the file before the test and cats it after. (It also shows the exit code, which is 130 = 128 + 2 = SIGINT.)Expected behavior
I expect the signal to be handled by the handler I've installed (which even shows up when I check process.listenerCount), for the process to not be killed, for the test to succeed, and for "killed" to appear in the log file.
Link to repl or repo (highly encouraged)
https://gist.github.com/glasser/cc6e7b429d8c388ac5de970dac805e11
envinfo
The text was updated successfully, but these errors were encountered: