bob.hpp
Loading...
Searching...
No Matches
bob::CmdRunner Class Reference

A class for running many commands in parallel. More...

#include <bob.hpp>

Public Member Functions

 CmdRunner (size_t process_count)
 Create a CmdRunner with a specified number of processes.
 
 CmdRunner (vector< Cmd > cmds)
 
 CmdRunner (vector< Cmd > cmds, size_t process_count)
 
 CmdRunner ()
 
size_t size ()
 Returns the number of commands in the runner.
 
void push (Cmd cmd)
 Push a single command to the runner.
 
void push_many (vector< Cmd > cmds)
 Push multiple commands to the runner.
 
void clear ()
 Clears all commands in the runner for reuse.
 
bool run ()
 Runs all commands in the runner concurrently.
 
bool all_succeded ()
 Returns true if all commands in the runner succeeded (exit code 0).
 
bool any_failed ()
 Returns true if any command in the runner failed (non-zero exit code).
 
void print_failed ()
 Prints the output of all commands that failed.
 
void capture_output (bool capture=true)
 Sets the capture_output flag for all commands in the runner.
 

Public Attributes

vector< Cmdcmds
 The commands to be run by this runner.
 
vector< int > exit_codes
 Exit codes for each command in cmds.
 

Detailed Description

A class for running many commands in parallel.

Examples
parallel-cmds/bob.cpp, and recipe/bob.cpp.

Constructor & Destructor Documentation

◆ CmdRunner() [1/3]

bob::CmdRunner::CmdRunner ( vector< Cmd cmds)

Create a CmdRunner with a list of commands.

The process count is the thread count of the current processor

◆ CmdRunner() [2/3]

bob::CmdRunner::CmdRunner ( vector< Cmd cmds,
size_t  process_count 
)

Create a CmdRunner with a list of commands and a maximum number of simultaneous processes.

◆ CmdRunner() [3/3]

bob::CmdRunner::CmdRunner ( )

Create an empty CmdRunner.

The process count is the thread count of the current processor


The documentation for this class was generated from the following file: