From eb6bc4dc3f821cd9430419733c7496e07241748c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 22 Aug 2017 18:23:32 +0300 Subject: Print diagnostics if child process terminated abnormally --- bpkg/utility.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'bpkg/utility.cxx') 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) { -- cgit v1.1