aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/utility.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-01-27 08:37:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-01-27 08:39:31 +0200
commit1abc10223b37d9ead3454a06e176b4b65370a2be (patch)
tree2d30c9130bb7acf2968078ed408e1d36b70c22b0 /libbuild2/utility.hxx
parentba637925b32e85c22c9dc81820e407ebdacfe5f7 (diff)
Improve process run_*() API
Diffstat (limited to 'libbuild2/utility.hxx')
-rw-r--r--libbuild2/utility.hxx36
1 files changed, 25 insertions, 11 deletions
diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx
index 5c6e984..a6ed8e0 100644
--- a/libbuild2/utility.hxx
+++ b/libbuild2/utility.hxx
@@ -242,25 +242,39 @@ namespace build2
[[noreturn]] LIBBUILD2_SYMEXPORT void
run_search_fail (const path&, const location& = location ());
+ // Wait for process termination returning true if the process exited
+ // normally with a zero code and false otherwise. The latter case is
+ // normally followed up with a call to run_finish().
+ //
+ LIBBUILD2_SYMEXPORT bool
+ run_wait (const char* args[], process&, const location& = location ());
+
+ bool
+ run_wait (cstrings& args, process&, const location& = location ());
+
// Wait for process termination. Issue diagnostics and throw failed in case
// of abnormal termination. If the process has terminated normally but with
- // a non-zero exit status, then, if error is true, assume the diagnostics
- // has already been issued and throw failed as well. Otherwise (error is
- // false), return false. The last argument is used in cooperation with
- // run_start() in case STDERR is redirected to STDOUT.
+ // a non-zero exit status, then assume the diagnostics has already been
+ // issued and just throw failed. The last argument is used in cooperation
+ // with run_start() in case STDERR is redirected to STDOUT.
//
- LIBBUILD2_SYMEXPORT bool
+ void
run_finish (const char* args[],
process&,
- bool error = true,
const string& = string (),
const location& = location ());
- inline void
- run_finish (cstrings& args, process& pr, const location& l = location ())
- {
- run_finish (args.data (), pr, true, string (), l);
- }
+ void
+ run_finish (cstrings& args, process& pr, const location& l = location ());
+
+ // As above but if the process has exited normally with a non-zero code,
+ // then return false rather than throwing.
+ //
+ bool
+ run_finish_code (const char* args[],
+ process&,
+ const string& = string (),
+ const location& = location ());
// Start a process with the specified arguments. If in is -1, then redirect
// STDIN to a pipe (can also be -2 to redirect to /dev/null or equivalent).