-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
behavior unhelpful for process kill default signal SIGTERM #2726
Comments
try SIGKILL? child.kill('SIGKILL') processes can recover from SIGTERM and SIGINT, but they cannot recover from SIGKILL tmk |
SIGINT works fine too since Mocha is specifically handling that; the real issue I see here is not lack of a signal that will work, but the fact that the default signal doesn't work. |
I am a bot that watches issues for inactivity. |
I don't actually understand what we're trying to fix. we want to |
Something like that. Last I checked, if I'm spawning |
If there's any way we can just avoid spawning in the first place, maybe this problem would magically disappear. |
This issue hasn't had any recent activity, and I'm labeling it |
So, with Mocha's programmatic API basically broken for running multiple times, I have a process that is
spawn
ing the commandline Mocha to run multiple times on demand. Then there's also the ability to stop one of these instances on demand. Naturally, child-process's.kill
method makes that easy, right?Today I learned:
.kill()
defaults to.kill('SIGTERM')
mocha
instance without affecting the_mocha
instance that is actually running the tests. [SEE UPDATE...] Not only that, but it seemed like it exited with code 0 reporting no signal stopped it (but I'd have to double-check that, as I was experimenting trying to see if I could find an easy fix, so it's possible my experiments were causing that bit). [UPDATE: Ran a quick double-check, and it seems to exit with no exit code and signal SIGTERM; exiting with code 0 and no signal reported must have been what happened when I tried to get Mocha to handle SIGTERM (see below).](This came up on a Mac using Node 6. I could fairly easily put together an integration test to demonstrate the issue if we wanted to see what all environments it affects, I think...)
Obviously, this is easy to handle outside of Mocha: use
.kill('SIGINT')
instead of.kill()
. But it was such counterintuitive and unhelpful default behavior, and considering that the alternative tospawn
(the programmatic API) is known to be broken in some cases, that I'm somewhat surprised we don't appear to have any existing issues about it.Anyway, does anyone know what it would take to fix this? I tried adding a SIGTERM handler and a process.on('exit' ... handler to the
mocha
file that runs_mocha
, but couldn't really get clean results like for SIGINT -- but maybe I was doing something wrong. I just figure that it's probably not worth it if it's difficult, but would be very much worth it if it happens to be easy. I know we're also considering switching to a library that would handle the Node flag spawning mechanism for us (#2517); I would be interested in seeing what happens if we use that and send.kill()
to aspawn
ed Mocha process.The text was updated successfully, but these errors were encountered: