aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cli/init.cxx4
-rw-r--r--build2/test/rule.cxx11
-rw-r--r--build2/test/script/runner.cxx19
-rw-r--r--build2/utility.cxx12
4 files changed, 15 insertions, 31 deletions
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index c698fd2..a4403a9 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -107,7 +107,9 @@ namespace build2
{
const char* args[] = {cli.string ().c_str (), "--version", nullptr};
- // @@ TODO: redo using run_start()/run_finish().
+ // @@ TODO: redo using run_start()/run_finish() or even
+ // run<string>(). We have the ability to ignore exit code and
+ // redirect STDERR to STDOUT.
try
{
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 869c23b..96941e6 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -639,16 +639,7 @@ namespace build2
dr << error;
print_process (dr, args);
-
- if (!pe.normal ())
- {
- dr << " terminated abnormally: " << pe.description ();
-
- if (pe.core ())
- dr << " (core dumped)";
- }
- else
- dr << " exited with code " << static_cast<uint16_t> (pe.code ());
+ dr << " " << pe;
}
return pr && wr;
diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx
index 2377774..cddd3a7 100644
--- a/build2/test/script/runner.cxx
+++ b/build2/test/script/runner.cxx
@@ -344,17 +344,7 @@ namespace build2
{
diag_record d (fail (ll));
print_process (d, args);
-
- if (!pe.normal ())
- {
- d << " terminated abnormally: " << pe.description ();
-
- if (pe.core ())
- d << " (core dumped)";
- }
- else
- d << " exited with code "
- << static_cast<uint16_t> (pe.code ());
+ d << " " << pe;
}
// Output doesn't match the expected result.
@@ -1683,12 +1673,7 @@ namespace build2
diag_record d (valid ? error (ll) : fail (ll));
if (!exit->normal ())
- {
- d << pr << " terminated abnormally: " << exit->description ();
-
- if (exit->core ())
- d << " (core dumped)";
- }
+ d << pr << " " << *exit;
else
{
uint16_t ec (exit->code ()); // Make sure is printed as integer.
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.