aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/dist
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-11-08 10:34:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-11-08 11:08:03 +0200
commit3bc0fc4c4496c345c79734dcd6dc56d44119aebf (patch)
treed058018aaf35641e461e51c2c20d374fd0d1684c /libbuild2/dist
parent84e6c7e62c9d1613af3cad81787b3f277d276140 (diff)
Make process exit diagnostics consistent
In particular, we now always print error message on non-0 exit except in cases where such exit is ignored.
Diffstat (limited to 'libbuild2/dist')
-rw-r--r--libbuild2/dist/operation.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/libbuild2/dist/operation.cxx b/libbuild2/dist/operation.cxx
index f6d00e4..078a8e2 100644
--- a/libbuild2/dist/operation.cxx
+++ b/libbuild2/dist/operation.cxx
@@ -741,7 +741,7 @@ namespace build2
if (verb >= 2)
print_process (args);
- run (ctx, cmd, args);
+ run (ctx, cmd, args, 1 /* finish_verbosity */);
}
// install <file> <dir>[/<name>]
@@ -784,7 +784,7 @@ namespace build2
if (verb >= 2)
print_process (args);
- run (t.ctx, cmd, args);
+ run (t.ctx, cmd, args, 1 /* finish_verbosity */);
return d / (n.empty () ? relf.leaf () : n);
}
@@ -957,10 +957,17 @@ namespace build2
out_fd.get () /* stdout */);
cpr.in_ofd.reset (); // Close the archiver's stdout on our side.
- run_finish (args.data () + i, cpr);
}
- run_finish (args.data (), apr);
+ // Delay throwing until we diagnose both ends of the pipe.
+ //
+ if (!run_finish_code (args.data (),
+ apr,
+ 1 /* verbosity */,
+ false /* omit_normal */) ||
+ !(i == 0 || run_finish_code (args.data () + i, cpr, 1, false)))
+ throw failed ();
+
out_rm.cancel ();
return ap;
@@ -1030,7 +1037,8 @@ namespace build2
args,
0 /* stdin */,
c_fd.get () /* stdout */));
- run_finish (args, pr);
+
+ run_finish (args, pr, 1 /* verbosity */);
}
else
{