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/cc | |
parent | ba637925b32e85c22c9dc81820e407ebdacfe5f7 (diff) |
Improve process run_*() API
Diffstat (limited to 'libbuild2/cc')
-rw-r--r-- | libbuild2/cc/gcc.cxx | 11 | ||||
-rw-r--r-- | libbuild2/cc/guess.cxx | 4 | ||||
-rw-r--r-- | libbuild2/cc/link-rule.cxx | 5 | ||||
-rw-r--r-- | libbuild2/cc/msvc.cxx | 2 |
4 files changed, 14 insertions, 8 deletions
diff --git a/libbuild2/cc/gcc.cxx b/libbuild2/cc/gcc.cxx index 5857709..91a04f6 100644 --- a/libbuild2/cc/gcc.cxx +++ b/libbuild2/cc/gcc.cxx @@ -219,11 +219,14 @@ namespace build2 is.close (); // Don't block. } - catch (const io_error&) + catch (const io_error& e) { - pr.wait (); - fail << "error reading " << x_lang << " compiler -print-search-dirs " - << "output"; + if (run_wait (args, pr)) + fail << "io error reading " << args[0] << " -print-search-dirs " + << "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 (args, pr); diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx index 053a4cb..d5fc884 100644 --- a/libbuild2/cc/guess.cxx +++ b/libbuild2/cc/guess.cxx @@ -224,7 +224,7 @@ namespace build2 // that. } - if (!run_finish (args.data (), pr, false /* error */, l)) + if (!run_finish_code (args.data (), pr, l)) r = "none"; if (r.empty ()) @@ -2077,7 +2077,7 @@ namespace build2 // that. } - if (!run_finish (args.data (), pr, false /* error */, l)) + if (!run_finish_code (args.data (), pr, l)) fail << "unable to extract MSVC information from " << xp; if (const char* w = ( diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index ccb8dc6..6969ef2 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -2127,9 +2127,12 @@ namespace build2 } catch (const io_error& e) { - if (pr.wait ()) // Ignore if child failed. + if (run_wait (args, pr)) fail << "unable to pipe resource file to " << args[0] << ": " << 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 (args, pr); diff --git a/libbuild2/cc/msvc.cxx b/libbuild2/cc/msvc.cxx index c7022fc..1bdd2bb 100644 --- a/libbuild2/cc/msvc.cxx +++ b/libbuild2/cc/msvc.cxx @@ -356,7 +356,7 @@ namespace build2 // that. } - if (!run_finish (args, pr, false, s)) + if (!run_finish_code (args, pr, s)) return otype::e; if (obj && dll) |