Skip to content

Commit 9297c58

Browse files
Stewart X AddisonMylesBorins
Stewart X Addison
authored andcommitted
build: don't squash signal handlers with --shared
An application using node built as a shared library may legitimately implement its own signal handling routines. Current behaviour is to squash all signal handlers on node startup. This change will stop that behaviour when node is built as a shared library. PR-URL: #10539 Fixes: #10520 Refs: #615 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 1f40d8e commit 9297c58

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/node.cc

+2
Original file line numberDiff line numberDiff line change
@@ -3957,6 +3957,7 @@ inline void PlatformInit() {
39573957

39583958
CHECK_EQ(err, 0);
39593959

3960+
#ifndef NODE_SHARED_MODE
39603961
// Restore signal dispositions, the parent process may have changed them.
39613962
struct sigaction act;
39623963
memset(&act, 0, sizeof(act));
@@ -3970,6 +3971,7 @@ inline void PlatformInit() {
39703971
act.sa_handler = (nr == SIGPIPE) ? SIG_IGN : SIG_DFL;
39713972
CHECK_EQ(0, sigaction(nr, &act, nullptr));
39723973
}
3974+
#endif // !NODE_SHARED_MODE
39733975

39743976
RegisterSignalHandler(SIGINT, SignalExit, true);
39753977
RegisterSignalHandler(SIGTERM, SignalExit, true);

0 commit comments

Comments
 (0)