forked from lix-project/lix
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.
This commit is contained in:
parent
9af10b753c
commit
3e347220c8
|
@ -33,6 +33,9 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string
|
||||||
out.create();
|
out.create();
|
||||||
|
|
||||||
auto conn = std::make_unique<Connection>();
|
auto conn = std::make_unique<Connection>();
|
||||||
|
ProcessOptions options;
|
||||||
|
options.dieWithParent = false;
|
||||||
|
|
||||||
conn->sshPid = startProcess([&]() {
|
conn->sshPid = startProcess([&]() {
|
||||||
restoreSignals();
|
restoreSignals();
|
||||||
|
|
||||||
|
@ -64,7 +67,7 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string
|
||||||
|
|
||||||
// could not exec ssh/bash
|
// could not exec ssh/bash
|
||||||
throw SysError("unable to execute '%s'", args.front());
|
throw SysError("unable to execute '%s'", args.front());
|
||||||
});
|
}, options);
|
||||||
|
|
||||||
|
|
||||||
in.readSide = -1;
|
in.readSide = -1;
|
||||||
|
@ -91,6 +94,9 @@ Path SSHMaster::startMaster()
|
||||||
Pipe out;
|
Pipe out;
|
||||||
out.create();
|
out.create();
|
||||||
|
|
||||||
|
ProcessOptions options;
|
||||||
|
options.dieWithParent = false;
|
||||||
|
|
||||||
state->sshMaster = startProcess([&]() {
|
state->sshMaster = startProcess([&]() {
|
||||||
restoreSignals();
|
restoreSignals();
|
||||||
|
|
||||||
|
@ -110,7 +116,7 @@ Path SSHMaster::startMaster()
|
||||||
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
|
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
|
||||||
|
|
||||||
throw SysError("unable to execute '%s'", args.front());
|
throw SysError("unable to execute '%s'", args.front());
|
||||||
});
|
}, options);
|
||||||
|
|
||||||
out.writeSide = -1;
|
out.writeSide = -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue