diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-08 14:14:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-08 14:14:26 +0200 |
commit | 36e0c88e7a3912c8a2e6594841172adb9c14525b (patch) | |
tree | 909a269ded721a0201a01d3493af6fc11dd75292 /bbot/utility | |
parent | cfd31379be5eefb22a72b5ee90ce8fd17a0802b7 (diff) |
Implement machine enumeration
Diffstat (limited to 'bbot/utility')
-rw-r--r-- | bbot/utility | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/bbot/utility b/bbot/utility index 81c6c87..ebab971 100644 --- a/bbot/utility +++ b/bbot/utility @@ -13,8 +13,8 @@ #include <butl/ft/lang> +#include <butl/process> #include <butl/utility> // casecmp(), reverse_iterate(), etc - #include <butl/filesystem> #include <bbot/types> @@ -39,6 +39,51 @@ namespace bbot using butl::exception_guard; using butl::make_exception_guard; + + // Process execution. + // + class tracer; + + template <typename I, typename O, typename E, typename P, typename... A> + void + run (tracer&, I&& in, O&& out, E&& err, P&&, A&&...); + + template <typename I, typename O, typename E, typename P, typename... A> + butl::process_exit::code_type + run_exit (tracer&, I&& in, O&& out, E&& err, P&&, A&&...); + + template <typename P, typename... A> + inline void + run (tracer& t, P&& p, A&&... a) + { + run (t, butl::fdnull (), 2, 2, forward<P> (p), forward<A> (a)...); + } + + template <typename P, typename... A> + inline butl::process_exit::code_type + run_exit (tracer& t, P&& p, A&&... a) + { + return run (t, butl::fdnull (), 2, 2, forward<P> (p), forward<A> (a)...); + } + + // Manifest parsing and serialization. + // + template <typename T> + T + parse_manifest (const path&, const char* what, bool ignore_unknown = true); + + template <typename T> + void + serialize_manifest (const T&, const path&, const char* what); + + template <typename T> + void + serialize_manifest (const T&, + ostream&, + const string& name, + const char* what); } +#include <bbot/utility.txx> + #endif // BBOT_UTILITY |