aboutsummaryrefslogtreecommitdiff
path: root/bbot/utility
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/utility')
-rw-r--r--bbot/utility47
1 files changed, 41 insertions, 6 deletions
diff --git a/bbot/utility b/bbot/utility
index ebab971..5bd4821 100644
--- a/bbot/utility
+++ b/bbot/utility
@@ -40,32 +40,67 @@ namespace bbot
using butl::exception_guard;
using butl::make_exception_guard;
+ // Random number generator (currently not MT-safe and limited to RAND_MAX).
+ //
+ size_t
+ genrand ();
+
+ template <typename T>
+ inline T
+ genrand () {return static_cast<T> (genrand ());}
+
// Process execution.
//
class tracer;
+ using butl::process;
+ using butl::process_exit;
+ using butl::process_error;
+
template <typename I, typename O, typename E, typename P, typename... A>
void
- run (tracer&, I&& in, O&& out, E&& err, P&&, A&&...);
+ run_io (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&&...);
+ process_exit::code_type
+ run_io_exit (tracer&, I&& in, O&& out, E&& err, P&&, A&&...);
+
+ template <typename I, typename O, typename E, typename P, typename... A>
+ process
+ run_io_start (tracer&,
+ I&& in,
+ O&& out,
+ E&& err,
+ const dir_path& cwd,
+ P&&,
+ A&&...);
+
+ template <typename P>
+ void
+ run_io_finish (tracer&, process&, P&&);
+
+ template <typename P>
+ process_exit::code_type
+ run_io_finish_exit (tracer&, process&, P&&);
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)...);
+ run_io (t, butl::fdnull (), 2, 2, forward<P> (p), forward<A> (a)...);
}
template <typename P, typename... A>
- inline butl::process_exit::code_type
+ inline 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)...);
+ return run_io_exit (
+ t, butl::fdnull (), 2, 2, forward<P> (p), forward<A> (a)...);
}
+ void
+ run_trace (tracer&, const char*[], size_t);
+
// Manifest parsing and serialization.
//
template <typename T>