#include <piped_process.h>
Definition at line 25 of file piped_process.h.
◆ send_responset
Enumeration for send response.
Enumerator |
---|
SUCCEEDED | |
FAILED | |
ERRORED | |
Definition at line 36 of file piped_process.h.
◆ statet
Enumeration to keep track of child process state.
Enumerator |
---|
RUNNING | |
ERRORED | |
Definition at line 29 of file piped_process.h.
◆ piped_processt() [1/2]
piped_processt::piped_processt |
( |
const std::vector< std::string > & |
commandvec, |
|
|
message_handlert & |
message_handler |
|
) |
| |
|
explicit |
Initiate a new subprocess with pipes supporting communication between the parent (this process) and the child.
- Parameters
-
commandvec | The command and arguments to create the process |
message_handler | Optional message handler for logging debug messages |
Definition at line 124 of file piped_process.cpp.
◆ piped_processt() [2/2]
◆ ~piped_processt()
piped_processt::~piped_processt |
( |
| ) |
|
◆ can_receive() [1/2]
bool piped_processt::can_receive |
( |
| ) |
|
See if this process can receive data from the other process.
Note this calls can_receive(0);
- Returns
- true if there is data to read from process, false otherwise.
Definition at line 513 of file piped_process.cpp.
◆ can_receive() [2/2]
bool piped_processt::can_receive |
( |
std::optional< std::size_t > |
wait_time | ) |
|
See if this process can receive data from the other process.
- Parameters
-
wait_time | Amount of time to wait before timing out, with:
- positive integer being wait time in milli-seconds,
- 0 signifying non-blocking immediate return, and
- an empty optional representing infinite wait time.
|
- Returns
- true is there is data to read from process, false otherwise
Definition at line 450 of file piped_process.cpp.
◆ get_status()
Get child process status.
- Returns
- a statet representing the status of the child process
Definition at line 445 of file piped_process.cpp.
◆ operator=()
◆ receive()
std::string piped_processt::receive |
( |
| ) |
|
Read a string from the child process' output.
- Returns
- a string containing data from the process, empty string if no data
Definition at line 401 of file piped_process.cpp.
◆ send()
Send a string message (command) to the child process.
- Parameters
-
message | The string message to be sent. |
- Returns
Definition at line 346 of file piped_process.cpp.
◆ wait_receivable()
void piped_processt::wait_receivable |
( |
int |
wait_time | ) |
|
Wait for the pipe to be ready, waiting specified time between checks.
Will return when the pipe is ready or the other process is not in a statet::CREATED state (i.e. error has occured).
- Parameters
-
wait_time | Time spent in usleep() (microseconds) between checks |
Definition at line 518 of file piped_process.cpp.
◆ wait_receive()
std::string piped_processt::wait_receive |
( |
| ) |
|
Wait until a string is available and read a string from the child process' output.
- Returns
- a string containing data from the process, empty string if no data
Definition at line 437 of file piped_process.cpp.
◆ child_process_id
pid_t piped_processt::child_process_id |
|
protected |
◆ command_stream
FILE* piped_processt::command_stream |
|
protected |
◆ log
◆ pipe_input
int piped_processt::pipe_input[2] |
|
protected |
◆ pipe_output
int piped_processt::pipe_output[2] |
|
protected |
◆ process_state
statet piped_processt::process_state |
|
protected |
The documentation for this class was generated from the following files: