aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-08-22 18:23:32 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-08-22 18:23:32 +0300
commiteb6bc4dc3f821cd9430419733c7496e07241748c (patch)
tree233ea2651ecc65572e9d6e7fae83ea4a28b24c1e
parent5bd4656d4e8b5a15e5ce6e696512b5d56401aea6 (diff)
Print diagnostics if child process terminated abnormally
-rw-r--r--bpkg/utility.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx
index 842a311..06e07a8 100644
--- a/bpkg/utility.cxx
+++ b/bpkg/utility.cxx
@@ -178,8 +178,22 @@ namespace bpkg
process pr (pp, args);
- if (!pr.wait ())
+ if (pr.wait ())
+ return;
+
+ assert (pr.exit);
+ const process_exit& pe (*pr.exit);
+
+ if (pe.normal ())
throw failed (); // Assume the child issued diagnostics.
+
+ diag_record dr (fail);
+ print_process (dr, args);
+
+ dr << " terminated abnormally: " << pe.description ();
+
+ if (pe.core ())
+ dr << " (core dumped)";
}
catch (const process_error& e)
{