about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTobias Möst <tbsmoest@gmail.com>2020-02-14T06·47+0100
committerEelco Dolstra <edolstra@gmail.com>2020-04-10T08·45+0200
commita25214a2bc38b3d8ed00f1f0f9244f23b63a52f6 (patch)
treee3822c96eabc351c4d3e0389dbd828e2d91e8346 /src
parent6d01e9a623774fbf7ec537ac4278924d5b1f21f8 (diff)
Fix PR_SET_PDEATHSIG results in Broken pipe (#2395)
The ssh client is lazily started by the first worker thread, that
requires a ssh connection. To avoid the ssh client to be killed, when
the worker process is stopped, do not set PR_SET_PDEATHSIG.

(cherry picked from commit 3e347220c82d1537723f49aa03a93a6f9d294417)
Diffstat (limited to 'src')
-rw-r--r--src/libstore/ssh.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstore/ssh.cc b/src/libstore/ssh.cc
index eb29c57bcaa2..dea16e533ef5 100644
--- a/src/libstore/ssh.cc
+++ b/src/libstore/ssh.cc
@@ -33,6 +33,9 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string
     out.create();
 
     auto conn = std::make_unique<Connection>();
+    ProcessOptions options;
+    options.dieWithParent = false;
+
     conn->sshPid = startProcess([&]() {
         restoreSignals();
 
@@ -64,7 +67,7 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string
 
         // could not exec ssh/bash
         throw SysError("unable to execute '%s'", args.front());
-    });
+    }, options);
 
 
     in.readSide = -1;
@@ -91,6 +94,9 @@ Path SSHMaster::startMaster()
     Pipe out;
     out.create();
 
+    ProcessOptions options;
+    options.dieWithParent = false;
+
     state->sshMaster = startProcess([&]() {
         restoreSignals();
 
@@ -110,7 +116,7 @@ Path SSHMaster::startMaster()
         execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
 
         throw SysError("unable to execute '%s'", args.front());
-    });
+    }, options);
 
     out.writeSide = -1;