From c7b8f3ec1a25a31bc08e74910a5632c766da4971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 10 Jun 2025 11:45:31 +0200 Subject: [PATCH] =?UTF-8?q?daemon:=20=E2=80=98runProgram=E2=80=99=20exits?= =?UTF-8?q?=20with=20127=20upon=20ENOENT=20or=20similar.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is in accordance with widespread conventions. Previously it would exit with code 1, which was misleading. * nix/libutil/util.cc (runProgram): Exit with 127 if ‘execv’ or ‘execvp’ fails. Change-Id: I5df214afffda69aa329a25afbc48f6cbfdd0961c --- nix/libutil/util.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc index 9a97270af90..77f2547b0a5 100644 --- a/nix/libutil/util.cc +++ b/nix/libutil/util.cc @@ -1193,7 +1193,9 @@ string runProgram(Path program, bool searchPath, const Strings & args) else execv(program.c_str(), stringsToCharPtrs(args_).data()); - throw SysError(format("executing `%1%'") % program); + int err = errno; + printMsg(lvlError, format("executing `%1%': %2%") % program % strerror(err)); + _exit(127); }); pipe.writeSide.close();