aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/utility.cxx
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.cxx
parentba637925b32e85c22c9dc81820e407ebdacfe5f7 (diff)
Improve process run_*() API
Diffstat (limited to 'libbuild2/utility.cxx')
-rw-r--r--libbuild2/utility.cxx28
1 files changed, 23 insertions, 5 deletions
diff --git a/libbuild2/utility.cxx b/libbuild2/utility.cxx
index 20f0c22..0c44a59 100644
--- a/libbuild2/utility.cxx
+++ b/libbuild2/utility.cxx
@@ -252,11 +252,22 @@ namespace build2
}
bool
- run_finish (const char* args[],
- process& pr,
- bool err,
- const string& l,
- const location& loc)
+ run_wait (const char* args[], process& pr, const location& loc)
+ try
+ {
+ return pr.wait ();
+ }
+ catch (const process_error& e)
+ {
+ fail (loc) << "unable to execute " << args[0] << ": " << e << endf;
+ }
+
+ bool
+ run_finish_impl (const char* args[],
+ process& pr,
+ bool err,
+ const string& l,
+ const location& loc)
try
{
tracer trace ("run_finish");
@@ -297,6 +308,13 @@ namespace build2
fail (loc) << "unable to execute " << args[0] << ": " << e << endf;
}
+ void
+ run_io_error (const char* args[], const io_error& e)
+ {
+ fail << "io error reading " << args[0] << " output: " << e << endf;
+ }
+
+
const string empty_string;
const path empty_path;
const dir_path empty_dir_path;