process: add one-shot signal handler support
This is a continuation of https://github.com/nodejs/node/pull/13894.
I've divided this PR into 2 different commits to address @mscdex comments from the original PR.
events: add isOnce arg to EventEmitter listeners
`isOnce` will be true when the new or removed listener was added using
the `EventEmitter.once()` method.
`one-shot` signal handlers reset the handler once the signal is received
and not when the signal notification reaches the main loop. This commit
adds support for this functionality when *only* there are `once`
listeners on a specific signal.
Fixes: https://github.com/nodejs/node/issues/15654 Refs: https://github.com/nodejs/node/issues/9050 Refs: https://github.com/libuv/libuv/issues/1104 Refs: https://github.com/libuv/libuv/pull/1106
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
events, process