Skip to content

Commit 83ab5f4

Browse files
gireeshpunathiltargos
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 b3e77a5 commit 83ab5f4

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
@@ -154,6 +154,13 @@ function setupSignalHandlers(internalBinding) {
154154
delete signalWraps[type];
155155
}
156156
});
157+
158+
// re-arm pre-existing signal event registrations
159+
// with this signal wrap capabilities.
160+
process.eventNames().forEach((ev) => {
161+
if (isSignal(ev))
162+
process.emit('newListener', ev);
163+
});
157164
}
158165

159166
function setupChildProcessIpcChannel() {

0 commit comments

Comments
 (0)