Simplify
(cherry picked from commit d1b238ec3cd74d652af46f577f992c9a44ac8e32)
This commit is contained in:
parent
7afd8321ed
commit
6d01e9a623
1 changed files with 2 additions and 5 deletions
|
@ -47,13 +47,10 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string
|
||||||
throw SysError("duping over stderr");
|
throw SysError("duping over stderr");
|
||||||
|
|
||||||
Strings args;
|
Strings args;
|
||||||
const char * execInto;
|
|
||||||
|
|
||||||
if (fakeSSH) {
|
if (fakeSSH) {
|
||||||
execInto = "bash";
|
|
||||||
args = { "bash", "-c" };
|
args = { "bash", "-c" };
|
||||||
} else {
|
} else {
|
||||||
execInto = "ssh";
|
|
||||||
args = { "ssh", host.c_str(), "-x", "-a" };
|
args = { "ssh", host.c_str(), "-x", "-a" };
|
||||||
addCommonSSHOpts(args);
|
addCommonSSHOpts(args);
|
||||||
if (socketPath != "")
|
if (socketPath != "")
|
||||||
|
@ -66,7 +63,7 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string
|
||||||
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
|
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
|
||||||
|
|
||||||
// could not exec ssh/bash
|
// could not exec ssh/bash
|
||||||
throw SysError("Failed to exec into %s. Is it in PATH?", execInto);
|
throw SysError("unable to execute '%s'", args.front());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,7 +109,7 @@ Path SSHMaster::startMaster()
|
||||||
addCommonSSHOpts(args);
|
addCommonSSHOpts(args);
|
||||||
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
|
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
|
||||||
|
|
||||||
throw SysError("Failed to exec into ssh. Is it in PATH?");
|
throw SysError("unable to execute '%s'", args.front());
|
||||||
});
|
});
|
||||||
|
|
||||||
out.writeSide = -1;
|
out.writeSide = -1;
|
||||||
|
|
Loading…
Reference in a new issue