diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-26 15:52:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-26 15:53:23 +0200 |
commit | 8276cb927bafd338be237adbecf437e70042da99 (patch) | |
tree | 49218b58e1f50a65b58674177e6047f1ac9f6831 /build2/utility.txx | |
parent | 2fd9d3f177429b20797897360931badedbb0f0ef (diff) |
Implement version module
Diffstat (limited to 'build2/utility.txx')
-rw-r--r-- | build2/utility.txx | 13 |
1 files changed, 10 insertions, 3 deletions
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 <typename T> + template <typename T, typename F> 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&) { |