* Install signal handlers for SIGTERM and SIGHUP. This ensures that
Nix is properly shut down when it receives those signals. In particular this ensures that killing the garbage collector doesn't cause a subsequent database recovery.
This commit is contained in:
parent
5bf939885a
commit
9311ab76a5
1 changed files with 4 additions and 0 deletions
|
@ -120,6 +120,10 @@ static void initAndRun(int argc, char * * argv)
|
||||||
act.sa_flags = 0;
|
act.sa_flags = 0;
|
||||||
if (sigaction(SIGINT, &act, &oact))
|
if (sigaction(SIGINT, &act, &oact))
|
||||||
throw SysError("installing handler for SIGINT");
|
throw SysError("installing handler for SIGINT");
|
||||||
|
if (sigaction(SIGTERM, &act, &oact))
|
||||||
|
throw SysError("installing handler for SIGTERM");
|
||||||
|
if (sigaction(SIGHUP, &act, &oact))
|
||||||
|
throw SysError("installing handler for SIGHUP");
|
||||||
|
|
||||||
/* Ignore SIGPIPE. */
|
/* Ignore SIGPIPE. */
|
||||||
act.sa_handler = SIG_IGN;
|
act.sa_handler = SIG_IGN;
|
||||||
|
|
Loading…
Reference in a new issue