summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGireesh Punathil <gpunathi@in.ibm.com>2018-11-26 01:38:47 -0500
committerRich Trott <rtrott@gmail.com>2018-11-28 10:33:21 -0800
commit25ad8decc6c15e45659053605af4f7b53dd64e1b (patch)
tree634774c2212073aa78480341e3740e2a236302dc /lib
parentacedf1a55a0a1712a5b06babc34694ef718275ef (diff)
downloadandroid-node-v8-25ad8decc6c15e45659053605af4f7b53dd64e1b.tar.gz
android-node-v8-25ad8decc6c15e45659053605af4f7b53dd64e1b.tar.bz2
android-node-v8-25ad8decc6c15e45659053605af4f7b53dd64e1b.zip
lib: rearm pre-existing signal event registrations
process.on('somesignal', ...) semantics expect the process to catch the signal and invoke the associated handler. `setupSignalHandlers` perform the additional task of preparing the libuv signal handler and associate it with the event handler. It is possible that by the time this is setup there could be pre-existing registrations that pre-date this setup in the boot sequence. So rearm pre-existing signal event registrations to get upto speed. Ref: https://github.com/nodejs/node/pull/22712#discussion_r232457318 PR-URL: https://github.com/nodejs/node/pull/24651 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/process/main_thread_only.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/internal/process/main_thread_only.js b/lib/internal/process/main_thread_only.js
index b8e518f6a1..148dfdc0f7 100644
--- a/lib/internal/process/main_thread_only.js
+++ b/lib/internal/process/main_thread_only.js
@@ -154,6 +154,13 @@ function setupSignalHandlers(internalBinding) {
delete signalWraps[type];
}
});
+
+ // re-arm pre-existing signal event registrations
+ // with this signal wrap capabilities.
+ process.eventNames().forEach((ev) => {
+ if (isSignal(ev))
+ process.emit('newListener', ev);
+ });
}
function setupChildProcessIpcChannel() {