forked from lix-project/hydra
hydra-queue-runner: better error message if nix-store can not be started
The hydra-queue-runner opens a connection to the builder. If the builder is 'localhost' it starts `nix-store`, otherwise it starts 'ssh'. Currently, if the hydra-queue-runner can not start `nix-store` (not in the PATH for instance), the error message is: cannot connect to ‘localhost’: error: cannot start ssh: No such file or directory This is not useful since ssh is actually not started:/ With this patch the error message is now: cannot connect to ‘localhost’: error: cannot start nix-store: No such file or directory
This commit is contained in:
parent
e0d8dcfe2d
commit
9a73ec6455
|
@ -29,6 +29,7 @@ static void append(Strings & dst, const Strings & src)
|
||||||
|
|
||||||
static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Child & child)
|
static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Child & child)
|
||||||
{
|
{
|
||||||
|
string pgmName;
|
||||||
Pipe to, from;
|
Pipe to, from;
|
||||||
to.create();
|
to.create();
|
||||||
from.create();
|
from.create();
|
||||||
|
@ -47,9 +48,12 @@ static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Chil
|
||||||
throw SysError("cannot dup stderr");
|
throw SysError("cannot dup stderr");
|
||||||
|
|
||||||
Strings argv;
|
Strings argv;
|
||||||
if (machine->sshName == "localhost")
|
if (machine->sshName == "localhost") {
|
||||||
|
pgmName = "nix-store";
|
||||||
argv = {"nix-store", "--serve", "--write"};
|
argv = {"nix-store", "--serve", "--write"};
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
|
pgmName = "ssh";
|
||||||
argv = {"ssh", machine->sshName};
|
argv = {"ssh", machine->sshName};
|
||||||
if (machine->sshKey != "") append(argv, {"-i", machine->sshKey});
|
if (machine->sshKey != "") append(argv, {"-i", machine->sshKey});
|
||||||
if (machine->sshPublicHostKey != "") {
|
if (machine->sshPublicHostKey != "") {
|
||||||
|
@ -66,7 +70,7 @@ static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Chil
|
||||||
|
|
||||||
execvp(argv.front().c_str(), (char * *) stringsToCharPtrs(argv).data()); // FIXME: remove cast
|
execvp(argv.front().c_str(), (char * *) stringsToCharPtrs(argv).data()); // FIXME: remove cast
|
||||||
|
|
||||||
throw SysError("cannot start ssh");
|
throw SysError("cannot start %s", pgmName);
|
||||||
});
|
});
|
||||||
|
|
||||||
to.readSide = -1;
|
to.readSide = -1;
|
||||||
|
|
Loading…
Reference in a new issue