diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-01-27 08:37:56 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-01-27 08:39:31 +0200 |
commit | 1abc10223b37d9ead3454a06e176b4b65370a2be (patch) | |
tree | 2d30c9130bb7acf2968078ed408e1d36b70c22b0 /libbuild2/parser.cxx | |
parent | ba637925b32e85c22c9dc81820e407ebdacfe5f7 (diff) |
Improve process run_*() API
Diffstat (limited to 'libbuild2/parser.cxx')
-rw-r--r-- | libbuild2/parser.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index f79f80e..59eeafd 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -1597,7 +1597,6 @@ namespace build2 dir_path () /* cwd */, nullptr /* env */, l)); - bool bad (false); try { // While a failing process could write garbage to stdout, for simplicity @@ -1627,19 +1626,17 @@ namespace build2 is.close (); // Detect errors. } - catch (const io_error&) + catch (const io_error& e) { - // Presumably the child process failed and issued diagnostics so let - // run_finish() try to deal with that first. - // - bad = true; + if (run_wait (cargs, pr, l)) + fail (l) << "io error reading " << cargs[0] << " output: " << e; + + // If the child process has failed then assume the io error was + // caused by that and let run_finish() deal with it. } run_finish (cargs, pr, l); - if (bad) - fail (l) << "error reading " << args[0] << " output"; - next_after_newline (t, tt); } |