#include <ProcessBuilder.hpp>
Active running process.
Similar design of subprocess.Popen. In c++ I didn't like
◆ Popen() [1/5]
subprocess::Popen::Popen |
( |
| ) |
|
|
inline |
Initialized as empty and invalid
◆ Popen() [2/5]
Starts command with specified options
◆ Popen() [3/5]
Starts command with specified options
◆ Popen() [4/5]
subprocess::Popen::Popen |
( |
const Popen & |
| ) |
|
|
delete |
◆ Popen() [5/5]
subprocess::Popen::Popen |
( |
Popen && |
| ) |
|
◆ ~Popen()
subprocess::Popen::~Popen |
( |
| ) |
|
Waits for process, Closes pipes and destroys any handles.
◆ close()
void subprocess::Popen::close |
( |
| ) |
|
Destructs the object and initializes to basic state
◆ close_cin()
void subprocess::Popen::close_cin |
( |
| ) |
|
|
inline |
◆ ignore_cerr()
void subprocess::Popen::ignore_cerr |
( |
| ) |
|
|
inline |
calls pipe_ignore_and_close on cerr
◆ ignore_cout()
void subprocess::Popen::ignore_cout |
( |
| ) |
|
|
inline |
calls pipe_ignore_and_close on cout
◆ ignore_output()
void subprocess::Popen::ignore_output |
( |
| ) |
|
|
inline |
calls pipe_ignore_and_close on cout, cerr if open
◆ kill()
bool subprocess::Popen::kill |
( |
| ) |
|
sends SIGKILL on linux, alias for terminate() on windows.
◆ operator=() [1/2]
Popen& subprocess::Popen::operator= |
( |
const Popen & |
| ) |
|
|
delete |
◆ operator=() [2/2]
◆ poll()
bool subprocess::Popen::poll |
( |
| ) |
|
- Returns
- true if terminated.
- Exceptions
-
OSError | If os specific error has been encountered. |
◆ send_signal()
bool subprocess::Popen::send_signal |
( |
int |
signal | ) |
|
Send the signal to the process.
On windows SIGTERM is an alias for terminate()
◆ terminate()
bool subprocess::Popen::terminate |
( |
| ) |
|
Sends SIGTERM, on windows calls TerminateProcess()
◆ wait()
int subprocess::Popen::wait |
( |
double |
timeout = -1 | ) |
|
Waits for process to finish.
If stdout or stderr is not read from, the child process may be blocked when it tries to write to the respective streams. You must ensure you continue to read from stdout/stderr. Call ignore_output() to spawn threads to ignore the output preventing a deadlock. You can also troll the child by closing your end.
- Parameters
-
timeout | timeout in seconds. Raises TimeoutExpired on timeout. NOT IMPLEMENTED, WILL WAIT FOREVER. |
- Returns
- returncode
- Exceptions
-
◆ args
◆ cerr
Read from this stream to get cerr output of process. This class holds the ownership and will call pipe_close().
◆ cin
Write to this stream to send data to the process. This class holds the ownership and will call pipe_close().
◆ cout
Read from this stream to get output of process. This class holds the ownership and will call pipe_close().
◆ pid
pid_t subprocess::Popen::pid = 0 |
◆ ProcessBuilder
friend subprocess::Popen::ProcessBuilder |
◆ returncode
The exit value of the process. Valid once process is completed
The documentation for this struct was generated from the following file: