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: https://github.com/nodejs/node/pull/10539
Fixes: https://github.com/nodejs/node/issues/10520
Refs: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Stewart X Addison authored and Myles Borins committed 2017-03-08 17:23:19 -08:00
1 parent 3516f35b77
commit e0dc0ceb37
1 file changed
+2
+2
View File
@@ -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));
@@ -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);