From 3bc0fc4c4496c345c79734dcd6dc56d44119aebf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 8 Nov 2022 10:34:22 +0200 Subject: Make process exit diagnostics consistent In particular, we now always print error message on non-0 exit except in cases where such exit is ignored. --- libbuild2/functions-process.cxx | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'libbuild2/functions-process.cxx') diff --git a/libbuild2/functions-process.cxx b/libbuild2/functions-process.cxx index 28b7a99..be10a26 100644 --- a/libbuild2/functions-process.cxx +++ b/libbuild2/functions-process.cxx @@ -174,7 +174,21 @@ namespace build2 // While assuming that the builtin has issued the diagnostics on failure // we still print the error message (see process_finish() for details). // - fail << bn << " builtin " << process_exit (rs) << endf; + diag_record dr; + dr << fail << "builtin " << bn << " " << process_exit (rs); + + // @@ TMP TODO: this and need to print command line at verbosite >= 3 + // line for the process case. + // +#if 0 + if (verb >= 1 && verb <= 2) + { + dr << info << "command line: "; + print_process (dr, args); + } +#endif + + dr << endf; } catch (const system_error& e) { @@ -328,15 +342,7 @@ namespace build2 void process_finish (const scope*, const cstrings& args, process& pr) { - try - { - if (!pr.wait ()) - fail << "process " << args[0] << " " << *pr.exit; - } - catch (const process_error& e) - { - fail << "unable to execute " << args[0] << ": " << e; - } + run_finish (args, pr, 2 /* verbosity */); } // Run a process. -- cgit v1.1