diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-02-01 13:00:21 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-02-01 13:00:21 +0100 |
commit | 7a65b2470eb53a320749d76746fbf65790183d9d (patch) | |
tree | 696a327d3a17a676d9ab9b723e8abcd7a7cef3ed /src/libstore | |
parent | 583ff4ec46fe1fa758f0fa4df1d8b37d9192736c (diff) |
Restore default signal handling in child processes
In particular, this fixes Ctrl-C in nix-shell sessions.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/build.cc | 4 | ||||
-rw-r--r-- | src/libstore/ssh-store.cc | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 7fb5271f4..40927c063 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -400,6 +400,8 @@ void Goal::trace(const format & f) /* Common initialisation performed in child processes. */ static void commonChildInit(Pipe & logPipe) { + restoreSignals(); + /* Put the child in a separate session (and thus a separate process group) so that it has no controlling terminal (meaning that e.g. ssh cannot open /dev/tty) and it doesn't receive @@ -2662,8 +2664,6 @@ void DerivationGoal::runChild() for (auto & i : drv->args) args.push_back(rewriteStrings(i, inputRewrites)); - restoreSIGPIPE(); - /* Indicate that we managed to set up the build environment. */ writeFull(STDERR_FILENO, string("\1\n")); diff --git a/src/libstore/ssh-store.cc b/src/libstore/ssh-store.cc index 3d0159400..f5d0a2704 100644 --- a/src/libstore/ssh-store.cc +++ b/src/libstore/ssh-store.cc @@ -91,6 +91,7 @@ ref<RemoteStore::Connection> SSHStore::openConnection() { if ((pid_t) sshMaster == -1) { sshMaster = startProcess([&]() { + restoreSignals(); if (key.empty()) execlp("ssh", "ssh", "-N", "-M", "-S", socketPath.c_str(), uri.c_str(), NULL); else |