mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 06:26:15 +02:00
Merge branch 'libstore-ssh-better-exec-error-message' of https://github.com/Profpatsch/nix
This commit is contained in:
commit
2da4c61049
1 changed files with 6 additions and 2 deletions
|
@ -47,10 +47,13 @@ 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 != "")
|
||||||
|
@ -62,7 +65,8 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string
|
||||||
args.push_back(command);
|
args.push_back(command);
|
||||||
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
|
execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());
|
||||||
|
|
||||||
throw SysError("executing '%s' on '%s'", command, host);
|
// could not exec ssh/bash
|
||||||
|
throw SysError("Failed to exec into %s. Is it in PATH?", execInto);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,7 +112,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("starting SSH master");
|
throw SysError("Failed to exec into ssh. Is it in PATH?");
|
||||||
});
|
});
|
||||||
|
|
||||||
out.writeSide = -1;
|
out.writeSide = -1;
|
||||||
|
|
Loading…
Reference in a new issue