From 1abc10223b37d9ead3454a06e176b4b65370a2be Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 27 Jan 2020 08:37:56 +0200 Subject: Improve process run_*() API --- libbuild2/utility.cxx | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'libbuild2/utility.cxx') 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; -- cgit v1.1