Fawkes API
Fawkes Development Version
|
#include <>>
Public Member Functions | |
SubProcess (const char *progname, const char *file, const char *argv[], const char *envp[]) | |
Constructor. More... | |
SubProcess (const char *progname, const char *file, const char *argv[], const char *envp[], fawkes::Logger *logger) | |
Constructor. More... | |
SubProcess (const std::string &progname, const std::string &file, const std::vector< std::string > &argv, const std::vector< std::string > &envp) | |
Constructor. More... | |
SubProcess (const std::string &progname, const std::string &file, const std::vector< std::string > &argv, const std::vector< std::string > &envp, fawkes::Logger *logger) | |
Constructor. More... | |
~SubProcess () | |
Destructor. More... | |
pid_t | pid () const |
Get PID of sub-process. More... | |
int | pipe_stdin_w () const |
Get stdin pipe file descriptor. More... | |
int | pipe_stdout_r () const |
Get stdout pipe file descriptor. More... | |
int | pipe_stderr_r () const |
Get stderr pipe file descriptor. More... | |
boost::asio::posix::stream_descriptor & | sd_stdin () |
Get stdin stream descriptor. More... | |
boost::asio::posix::stream_descriptor & | sd_stdout () |
Get stdout stream descriptor. More... | |
boost::asio::posix::stream_descriptor & | sd_stderr () |
Get stderr stream descriptor. More... | |
void | kill (int signum) |
Send a signal to the process. More... | |
void | check_proc () |
Check if the process is still alive. More... | |
bool | alive () |
Check if process is alive. More... | |
int | exit_status () |
Get exit status of process once it ended. More... | |
Sub-process execution with stdin/stdout/stderr redirection. This class executes a sub-process and monitors it and supports redirecting stdout/stderr to a logger.
fawkes::SubProcess::SubProcess | ( | const char * | progname, |
const char * | file, | ||
const char * | argv[], | ||
const char * | envp[] | ||
) |
Constructor.
progname | name of program, component name for logging |
file | file to execute, can be a program in the path or a fully qualified path |
argv | array of arguments for the process, the last element must be NULL |
envp | array of environment variables for the process, the last element must be NULL. Can be NULL to omit. |
fawkes::SubProcess::SubProcess | ( | const char * | progname, |
const char * | file, | ||
const char * | argv[], | ||
const char * | envp[], | ||
fawkes::Logger * | logger | ||
) |
Constructor.
progname | name of program, component name for logging |
file | file to execute, can be a program in the path or a fully qualified path |
argv | array of arguments for the process, the last element must be NULL |
envp | array of environment variables for the process, the last element must be NULL. Can be NULL to omit. |
logger | logger to redirect stdout and stderr to |
fawkes::SubProcess::SubProcess | ( | const std::string & | progname, |
const std::string & | file, | ||
const std::vector< std::string > & | argv, | ||
const std::vector< std::string > & | envp | ||
) |
Constructor.
progname | name of program, component name for logging |
file | file to execute, can be a program in the path or a fully qualified path |
argv | array of arguments for the process, the last element must be NULL |
envp | array of environment variables for the process, the last element must be NULL. Can be NULL to omit. |
fawkes::SubProcess::SubProcess | ( | const std::string & | progname, |
const std::string & | file, | ||
const std::vector< std::string > & | argv, | ||
const std::vector< std::string > & | envp, | ||
fawkes::Logger * | logger | ||
) |
Constructor.
progname | name of program, component name for logging |
file | file to execute, can be a program in the path or a fully qualified path |
argv | array of arguments for the process, the last element must be NULL |
envp | array of environment variables for the process, the last element must be NULL. Can be NULL to omit. |
logger | logger to redirect stdout and stderr to |
bool fawkes::SubProcess::alive | ( | ) |
void fawkes::SubProcess::check_proc | ( | ) |
Check if the process is still alive.
Definition at line 380 of file proc.cpp.
References fawkes::Logger::log_error().
Referenced by OpenPRSThread::loop().
int fawkes::SubProcess::exit_status | ( | ) |
void fawkes::SubProcess::kill | ( | int | signum | ) |
Send a signal to the process.
signum | signal number |
Definition at line 193 of file proc.cpp.
References pid(), pipe_stderr_r(), pipe_stdin_w(), and pipe_stdout_r().
Referenced by OpenPRSThread::finalize().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |