From 8065636673e85704f5aab3ce3674dea729cd2a86 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 17 Dec 2017 08:53:02 +0200 Subject: Trace non-zero process exit code Also convert to using operator<<(ostream,process_exit). --- build2/utility.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'build2/utility.cxx') diff --git a/build2/utility.cxx b/build2/utility.cxx index e8e5fe9..8d63059 100644 --- a/build2/utility.cxx +++ b/build2/utility.cxx @@ -240,21 +240,27 @@ namespace build2 run_finish (const char* args[], process& pr, bool err, const string& l) try { + tracer trace ("run_finish"); + if (pr.wait ()) return true; const process_exit& e (*pr.exit); if (!e.normal ()) - fail << "process " << args[0] << " terminated abnormally: " - << e.description () << (e.core () ? " (core dumped)" : ""); + fail << "process " << args[0] << " " << e; // Normall but non-zero exit status. // if (err) - // Assuming diagnostics has already been issued (to STDERR). + { + // While we assuming diagnostics has already been issued (to STDERR), if + // that's not the case, it's a real pain to debug. So trace it. // + l4 ([&]{trace << "process " << args[0] << " " << e;}); + throw failed (); + } // Even if the user asked to suppress diagnostiscs, one error that we // want to let through is the inability to execute the program itself. -- cgit v1.1