|
cprover
|
#include <piped_process.h>
Public Types | |
| enum class | statet { RUNNING , ERRORED } |
| Enumeration to keep track of child process state. More... | |
| enum class | send_responset { SUCCEEDED , FAILED , ERRORED } |
| Enumeration for send response. More... | |
Public Member Functions | |
| send_responset | send (const std::string &message) |
| Send a string message (command) to the child process. | |
| std::string | receive () |
| Read a string from the child process' output. | |
| std::string | wait_receive () |
| Wait until a string is available and read a string from the child process' output. | |
| statet | get_status () |
| Get child process status. | |
| bool | can_receive (std::optional< std::size_t > wait_time) |
| See if this process can receive data from the other process. | |
| bool | can_receive () |
| See if this process can receive data from the other process. | |
| void | wait_receivable (int wait_time) |
| Wait for the pipe to be ready, waiting specified time between checks. | |
| piped_processt (const std::vector< std::string > &commandvec, message_handlert &message_handler) | |
| Initiate a new subprocess with pipes supporting communication between the parent (this process) and the child. | |
| piped_processt (const piped_processt &)=delete | |
| piped_processt & | operator= (const piped_processt &)=delete |
| ~piped_processt () | |
Protected Attributes | |
| pid_t | child_process_id |
| FILE * | command_stream |
| int | pipe_input [2] |
| int | pipe_output [2] |
| statet | process_state |
| messaget | log |
Definition at line 25 of file piped_process.h.
|
strong |
Enumeration for send response.
| Enumerator | |
|---|---|
| SUCCEEDED | |
| FAILED | |
| ERRORED | |
Definition at line 36 of file piped_process.h.
|
strong |
Enumeration to keep track of child process state.
| Enumerator | |
|---|---|
| RUNNING | |
| ERRORED | |
Definition at line 29 of file piped_process.h.
|
explicit |
Initiate a new subprocess with pipes supporting communication between the parent (this process) and the child.
| commandvec | The command and arguments to create the process |
| message_handler | Optional message handler for logging debug messages |
Definition at line 127 of file piped_process.cpp.
|
delete |
| piped_processt::~piped_processt | ( | ) |
Definition at line 335 of file piped_process.cpp.
| bool piped_processt::can_receive | ( | ) |
See if this process can receive data from the other process.
Note this calls can_receive(0);
Definition at line 527 of file piped_process.cpp.
| bool piped_processt::can_receive | ( | std::optional< std::size_t > | wait_time | ) |
See if this process can receive data from the other process.
| wait_time | Amount of time to wait before timing out, with:
|
Definition at line 464 of file piped_process.cpp.
| piped_processt::statet piped_processt::get_status | ( | ) |
Get child process status.
Definition at line 459 of file piped_process.cpp.
|
delete |
| std::string piped_processt::receive | ( | ) |
Read a string from the child process' output.
Definition at line 415 of file piped_process.cpp.
|
nodiscard |
Send a string message (command) to the child process.
| message | The string message to be sent. |
Definition at line 360 of file piped_process.cpp.
| 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).
| wait_time | Time spent in usleep() (microseconds) between checks |
Definition at line 532 of file piped_process.cpp.
| std::string piped_processt::wait_receive | ( | ) |
Wait until a string is available and read a string from the child process' output.
Definition at line 451 of file piped_process.cpp.
|
protected |
Definition at line 104 of file piped_process.h.
|
protected |
Definition at line 105 of file piped_process.h.
|
protected |
Definition at line 114 of file piped_process.h.
|
protected |
Definition at line 110 of file piped_process.h.
|
protected |
Definition at line 111 of file piped_process.h.
|
protected |
Definition at line 113 of file piped_process.h.