aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/script/run.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-11-10 17:54:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-11-14 14:12:22 +0300
commit9254560cc32fe219da9d9fe454e396e8f2a13b33 (patch)
treedb911671b0e3df3cf670a5458ad156c62e39b0d8 /libbuild2/script/run.cxx
parent91119c23370c54cd74d6350bcba7975805c3e9bf (diff)
Make $process.run() print builtin command line on error and verbosity level >= 3
Diffstat (limited to 'libbuild2/script/run.cxx')
-rw-r--r--libbuild2/script/run.cxx35
1 files changed, 13 insertions, 22 deletions
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)