From 9a73ec6455a3c422c0281951fa94791d4d31db2f Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Tue, 22 Jan 2019 17:27:36 +0100 Subject: [PATCH] hydra-queue-runner: better error message if nix-store can not be started MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/hydra-queue-runner/build-remote.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index dccc4469..69c430eb 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -29,6 +29,7 @@ static void append(Strings & dst, const Strings & src) static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Child & child) { + string pgmName; Pipe to, from; to.create(); from.create(); @@ -47,9 +48,12 @@ static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Chil throw SysError("cannot dup stderr"); Strings argv; - if (machine->sshName == "localhost") + if (machine->sshName == "localhost") { + pgmName = "nix-store"; argv = {"nix-store", "--serve", "--write"}; + } else { + pgmName = "ssh"; argv = {"ssh", machine->sshName}; if (machine->sshKey != "") append(argv, {"-i", machine->sshKey}); 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 - throw SysError("cannot start ssh"); + throw SysError("cannot start %s", pgmName); }); to.readSide = -1;