Skip to content

Commit

Permalink
build: don't squash signal handlers with --shared
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
Stewart X Addison authored and MylesBorins committed Feb 22, 2017
1 parent 4a077cc commit 9b35715
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3957,6 +3957,7 @@ inline void PlatformInit() {

CHECK_EQ(err, 0);

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

RegisterSignalHandler(SIGINT, SignalExit, true);
RegisterSignalHandler(SIGTERM, SignalExit, true);
Expand Down

0 comments on commit 9b35715

Please sign in to comment.