diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-07-22 12:47:21 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2016-07-23 20:13:21 +0300 |
commit | 2d9579da2144b2a8d67ea1d05fde96ec9d365944 (patch) | |
tree | b4e033f0e8284309efeecd68ba1e9cd70dc75220 /build2/utility.txx | |
parent | 3425432752d362341b8e39cd319d7f3c56aef169 (diff) |
Adapt to fdstream extension
Diffstat (limited to 'build2/utility.txx')
-rw-r--r-- | build2/utility.txx | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/build2/utility.txx b/build2/utility.txx index bf9d9ab..a00f3fb 100644 --- a/build2/utility.txx +++ b/build2/utility.txx @@ -13,24 +13,30 @@ namespace build2 sha256* checksum) { process pr (start_run (args, err)); - ifdstream is (pr.in_ofd); T r; - string l; // Last line of output. - while (is.peek () != ifdstream::traits_type::eof () && // Keep last line. - getline (is, l)) + + try { - trim (l); + ifdstream is (pr.in_ofd); - if (checksum != nullptr) - checksum->append (l); + while (is.peek () != ifdstream::traits_type::eof () && // Keep last line. + getline (is, l)) + { + trim (l); - if (r.empty ()) - r = f (l); - } + if (checksum != nullptr) + checksum->append (l); - is.close (); // Don't block. + if (r.empty ()) + r = f (l); + } + } + catch (const ifdstream::failure&) + { + // Presumably the child process failed. Let finish_run() deal with that. + } if (!(finish_run (args, err, pr, l) || ignore_exit)) r = T (); |