8 #ifdef HAVE_SYS_TYPES_H
34 void exit(
int code = 0);
53 void exec(
const std::string command);
54 void exec(
const std::string binary,
const std::vector<std::string> argv);
66 int in_read(
char* buf,
const int len);
67 int in_write(
const char* buf,
const int len);
68 int out_read(
char* buf,
const int len);
69 int out_write(
const char* buf,
const int len);
70 int err_read(
char* buf,
const int len);
71 int err_write(
const char* buf,
const int len);
73 void print(std::ostream& out);
void reroute_stdio(void)
Called by the child to reroute the child's stdin, stdout, and stderr to the parent.
int child_signal_no(void)
If the child was signaled, return the signal number.
pid_t child_pid(void)
Returns the child's PID.
bool err_eof(void)
Check for err EOF.
bool out_eof(void)
Check for output EOF.
void fork(void)
Fork a child process.
void kill_child(void)
Send a KILL signal to the child.
int err_read(char *buf, const int len)
Allow parent to read from err_fd()
void exit(int code=0)
Called by the child to exit with a particular code.
void signal_child(int signal_no)
Send a signal to the child.
bool err_ready(void)
Check I/O for output.
bool out_ready(void)
Check I/O for output.
bool child_started(void) const
Returns true if the child has been started.
int in_write(const char *buf, const int len)
Allow parent to write output to in_fd()
int out_fd(void)
Return a file descriptor for I/O between parent a child.
void hup_child(void)
Send a HUP signal to the child.
bool child_running(void)
Returns true if the child is running.
void clear(void)
Reset the execute class to default values, kill the child processif one is running.
bool child_exited_success(void)
Returns true if the child returned exit code 0 and no caught signals.
void exec(const std::string command)
Execute a command, rerouting stdin, stdout, and stderr to parent.
int err_write(const char *buf, const int len)
Allow child to write to err_fd()
int out_read(char *buf, const int len)
Allow parent to read out_fd()
bool child_signaled(void)
Returns true if the child was signaled.
int child_exit_code(void)
Return the child's exit code.
void print(std::ostream &out)
Dump execute object information – used for debugging.
bool child_exited_normally(void)
Returns true if the child has exited normally.
bool check_read_ready_(int fd)
Return true if the file descriptor has input ready to be read.
Fork a child process or execute an external program.
pid_t check_child_(void)
Check the child's status.
int in_read(char *buf, const int len)
Allow child to read input from in_fd()
bool in_ready(void)
Check I/O for input.
bool in_eof(void)
Check for input EOF.
bool child_exited(void)
Returns true of the child has existed.
pid_t my_pid(void)
Returns the PID.
int err_fd(void)
Return a file descriptor for I/O between parent and child.
int out_write(const char *buf, const int len)
Allow child to write to out_fd()
bool check_write_ready_(int fd)
Return true if the file descriptor is ready to be written to.
void wait(void)
Wait for the child to exit.
std::ostream & operator<<(std::ostream &out, execute &exe)
Convenience function to call execute::print()
bool is_child(void)
Returns true if called by the child.
bool is_parent(void)
Returns true if called by the parent.
int in_fd(void)
Return a file descriptor for I/O between parent and child.