Skip to content

Commit 54d847d

Browse files
gireeshpunathilrvagg
authored andcommitted
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: #22712 (comment) PR-URL: #24651 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent e7b8067 commit 54d847d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/internal/process/main_thread_only.js

+7
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ function setupSignalHandlers() {
102102
delete signalWraps[type];
103103
}
104104
});
105+
106+
// re-arm pre-existing signal event registrations
107+
// with this signal wrap capabilities.
108+
process.eventNames().forEach((ev) => {
109+
if (isSignal(ev))
110+
process.emit('newListener', ev);
111+
});
105112
}
106113

107114
function setupChildProcessIpcChannel() {

0 commit comments

Comments
 (0)