From 7de1b2a6980f71cfbf36f7250e247f6eafd763d9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 1 Nov 2003 21:11:52 +0000 Subject: * Print the exit code of the builder. --- src/libnix/exec.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/libnix/exec.cc') diff --git a/src/libnix/exec.cc b/src/libnix/exec.cc index 4934712f9e4e..00d9e6a0ac03 100644 --- a/src/libnix/exec.cc +++ b/src/libnix/exec.cc @@ -111,9 +111,17 @@ void runProgram(const string & program, if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { if (keepFailed) { msg(lvlTalkative, - format("build failed; keeping build directory `%1%'") % tmpDir); + format("program `%1%' failed; keeping build directory `%2%'") + % program % tmpDir); delTmpDir.cancel(); } - throw Error("unable to build package"); + if (WIFEXITED(status)) + throw Error(format("program `%1%' failed with exit code %2%") + % program % WEXITSTATUS(status)); + else if (WIFSIGNALED(status)) + throw Error(format("program `%1%' failed due to signal %2%") + % program % WTERMSIG(status)); + else + throw Error(format("program `%1%' died abnormally") % program); } } -- cgit 1.4.1