wreport::subprocess::Popen Class Reference
Inheritance diagram for wreport::subprocess::Popen:

## Public Member Functions

| Popen (std::initializer_list< std::string > args)
void | copy_env_from_parent ()
| Override env with the contents of environment.
void | setenv (const std::string &key, const std::string &val)
| Child ()=default
| Child (const Child &)=delete
| Child (Child &&)=delete
Public Member Functions inherited from wreport::subprocess::Child
int | get_stdin () const
| Return the file descriptor to the stdin pipe to the child process, if configured, else -1.
int | get_stdout () const
| Return the file descriptor to the stdout pipe from the child process, if configured, else -1.
int | get_stderr () const
| Return the file descriptor to the stderr pipe from the child process, if configured, else -1.
void | set_stdin (int fd)
| Request to redirect the child stdin to this given file descriptor.
void | set_stdin (Redirect val)
| Request to redirect the child stdin according to val.
void | set_stdout (int fd)
| Request to redirect the child stdout to this given file descriptor.
void | set_stdout (Redirect val)
| Request to redirect the child stdout according to val.
void | set_stderr (int fd)
| Request to redirect the child stderr to this given file descriptor.
void | set_stderr (Redirect val)
| Request to redirect the child stderr according to val.
void | close_stdin ()
| Close the pipe to the child process stdin.
void | close_stdout ()
| Close the pipe from the child process stdout.
void | close_stderr ()
| Close the pipe from the child process stderr.
| Child (const Child &)=delete
| Child (Child &&)=delete
Child & | operator= (const Child &)=delete
Child & | operator= (Child &&)=delete
void | fork ()
| Start the child process.
pid_t | pid () const
| Return the PID of the subprocess, or 0 if it has not started yet.
int | returncode () const
| Return the return code of the subprocess; this is undefined if it has not terminated yet.
int | raw_returncode () const
| Return the raw return code as returned by wait(2).
bool | started () const
| Return true if the process has started.
bool | terminated () const
| Return true if the process has terminated.
bool | poll ()
| Check if the process has terminated. Returns true if it has.
int | wait ()
| Wait for the child process to terminate and return its return code.
bool | wait (int msecs)
| Wait for the child process to terminate.
void | send_signal (int sig)
| Send the given signal to the process.
void | terminate ()
| Send SIGTERM to the process.
void | kill ()
| Send SIGKILL to the process.

## Data Fields

std::vector< std::string > | args
| argv of the child process
std::string | executable
| pathname to the executable of the child process, defaults to args[0] if empty
std::vector< std::string > | env
| environment variables to use for the child process
Data Fields inherited from wreport::subprocess::Child
bool | close_fds = true
| After fork, close all file descriptors >=2 in the child.
std::vector< int > | pass_fds
| Do not close these file descriptors in the child process (implies close_fds = true).
std::string | cwd
| Change to this directory in the child process.
bool | start_new_session = false
| If true, call setsid() in the child process.

## Protected Member Functions

int | main () noexcept override
| Main function called in the child process.
Protected Member Functions inherited from wreport::subprocess::Child
virtual void | pre_fork ()
| Function called before forking.
virtual void | post_fork_parent ()
| Function called after fork in the parent process.
virtual void | post_fork_child ()
| Function called after fork in the child process.

## Additional Inherited Members

Static Public Member Functions inherited from wreport::subprocess::Child
static std::string | format_raw_returncode (int raw_returncode)
| Format the status code returned by wait(2).
Protected Attributes inherited from wreport::subprocess::Child
pid_t | m_pid = 0
int | m_returncode = 0
bool | m_terminated = false
int | m_stdin [2] = { -1, -1 }
int | m_stdout [2] = { -1, -1 }
int | m_stderr [2] = { -1, -1 }
Redirect | m_stdin_action = Redirect::UNCHANGED
Redirect | m_stdout_action = Redirect::UNCHANGED
Redirect | m_stderr_action = Redirect::UNCHANGED

## Member Function Documentation

## main()

int wreport::subprocess::Popen::main | ( |  | ) |

override protected virtual noexcept

Main function called in the child process.

Its result will be used as the return code for the process.

Implements wreport::subprocess::Child.

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

- subprocess.h