From 8276cb927bafd338be237adbecf437e70042da99 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 26 Apr 2017 15:52:15 +0200 Subject: Implement version module --- build2/utility.txx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'build2/utility.txx') diff --git a/build2/utility.txx b/build2/utility.txx index 2cc6a33..28c7d6e 100644 --- a/build2/utility.txx +++ b/build2/utility.txx @@ -29,11 +29,11 @@ namespace build2 return p; } - template + template T run (const process_path& pp, const char* args[], - T (*f) (string&), + F&& f, bool err, bool ignore_exit, sha256* checksum) @@ -45,7 +45,7 @@ namespace build2 try { - ifdstream is (move (pr.in_ofd)); + ifdstream is (move (pr.in_ofd), butl::fdstream_mode::skip); while (is.peek () != ifdstream::traits_type::eof () && // Keep last line. getline (is, l)) @@ -56,8 +56,15 @@ namespace build2 checksum->append (l); if (r.empty ()) + { r = f (l); + + if (!r.empty () && checksum == nullptr) + break; + } } + + is.close (); } catch (const io_error&) { -- cgit v1.1