From 9254560cc32fe219da9d9fe454e396e8f2a13b33 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 10 Nov 2022 17:54:57 +0300 Subject: Make $process.run() print builtin command line on error and verbosity level >= 3 --- libbuild2/script/run.cxx | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'libbuild2/script/run.cxx') diff --git a/libbuild2/script/run.cxx b/libbuild2/script/run.cxx index 1ce5564..cbd750f 100644 --- a/libbuild2/script/run.cxx +++ b/libbuild2/script/run.cxx @@ -1715,13 +1715,7 @@ namespace build2 auto process_args = [&c] () -> cstrings { - cstrings args {c.program.recall_string ()}; - - for (const auto& a: c.arguments) - args.push_back (a.c_str ()); - - args.push_back (nullptr); - return args; + return build2::process_args (c.program.recall_string (), c.arguments); }; // Prior to opening file descriptors for command input/output redirects @@ -2450,30 +2444,27 @@ namespace build2 if (!valid || (!success && diag)) { - dr << error (ll) << w << ' '; + dr << error (ll) << w << ' ' << pr << ' '; if (!exit->normal ()) - dr << pr << ' ' << *exit; + dr << *exit; else { uint16_t ec (exit->code ()); // Make sure printed as integer. if (!valid) - dr << pr << " exit code " << ec << " out of 0-255 range"; - else if (!success) + dr << "exit code " << ec << " out of 0-255 range"; + else { - if (diag) - { - if (cmd.exit) - dr << pr << " exit code " << ec - << (cmp == exit_comparison::eq ? " != " : " == ") - << exc; - else - dr << pr << " exited with code " << ec; - } + assert (!success && diag); + + if (cmd.exit) + dr << "exit code " << ec + << (cmp == exit_comparison::eq ? " != " : " == ") + << exc; + else + dr << "exited with code " << ec; } - else - assert (false); } if (verb == 1) -- cgit v1.1