3#ifndef WIBBLE_SYS_CHILDPROCESS_H
4#define WIBBLE_SYS_CHILDPROCESS_H
131 void kill(
int signal);
Fork a child process.
Definition childprocess.h:43
ChildProcess()
Definition childprocess.h:88
void setupChild()
Definition childprocess.cpp:187
void setExec(std::string command)
Instead of calling the main() function of this class, execute an external command.
Definition childprocess.h:94
bool running()
Definition childprocess.cpp:247
void setupPrefork()
Definition childprocess.cpp:164
virtual void spawnChild()
On Windows, it's impossible to fork(), but if you were to fork+exec, it's not all lost.
Definition childprocess.cpp:48
pid_t fork()
For a subprocess to run proc.
void setupParent()
Definition childprocess.cpp:216
int wait(struct rusage *ru=0)
Wait for the child to finish, returning its exit status and optionally storing resource usage informa...
Definition childprocess.cpp:270
void waitError()
Definition childprocess.cpp:240
int * _stderr
Definition childprocess.h:48
void kill(int signal)
Send the given signal to the process.
Definition childprocess.cpp:310
pid_t pid() const
Get the pid of the child process or (pid_t)-1 if no child is running.
Definition childprocess.h:119
void setupRedirects(int *stdinfd=0, int *stdoutfd=0, int *stderrfd=0)
Definition childprocess.cpp:145
pid_t forkAndRedirect(int *stdinfd=0, int *stdoutfd=0, int *stderrfd=0)
Definition childprocess.h:107
int pipes[3][2]
Definition childprocess.h:46
bool m_doExec
Definition childprocess.h:50
std::string m_command
Definition childprocess.h:51
int * _stdout
Definition childprocess.h:48
virtual int main()=0
Main function to be called in the child process after it has forked.
int * _stdin
Definition childprocess.h:48
void waitForSuccess()
Definition childprocess.cpp:287
virtual ~ChildProcess()
Definition childprocess.h:89
pid_t _pid
Definition childprocess.h:45
int m_status
Definition childprocess.h:49