|
RADLib
RADical C++ application framework
|
Child process helper for stdout/stderr capture. More...
#include <RADCore.h>
Inheritance diagram for RADCore::RADProcess:
Collaboration diagram for RADCore::RADProcess:Public Member Functions | |
| RADProcess () | |
| Creates a non-running process. More... | |
| ~RADProcess () override | |
| Kills or cleans up the process if needed. More... | |
| bool | start (const std::string &program, const std::vector< std::string > &arguments={}) |
| Starts program with arguments. More... | |
| bool | waitForFinished (int timeoutMs=-1) |
| Waits for process exit; timeoutMs < 0 waits indefinitely. More... | |
| void | kill () |
| Sends a kill request to the process. More... | |
| ProcessState | state () const |
| Returns process state. More... | |
| int | exitCode () const |
| Returns exit code after finish. More... | |
| std::string | readAllStandardOutput () const |
| Returns captured stdout. More... | |
| std::string | readAllStandardError () const |
| Returns captured stderr. More... | |
Public Member Functions inherited from RADCore::RADObject | |
| RADObject () | |
| Creates a RADObject bound to the current thread. More... | |
| virtual | ~RADObject () |
| Disconnects tracked event links and releases lifetime token. More... | |
| void | registerLink (const ConnectionRecord &record) |
| Registers a connection for cleanup when this object is destroyed. More... | |
| std::thread::id | threadId () const |
| Returns the thread id this object is currently associated with. More... | |
| EventLoop * | associatedEventLoop () const |
| Returns the associated event loop, if any. More... | |
| ThreadAffinity | threadAffinity () const |
| Returns both thread id and associated loop atomically. More... | |
| std::weak_ptr< void > | lifetimeToken () const |
| Returns a weak token used to drop queued callbacks after destruction. More... | |
| void | moveToThread (std::thread::id tId, EventLoop *loop=nullptr) |
| Moves the object's affinity to tId and optional loop. More... | |
Public Attributes | |
| RADCore::Event< void() > | started |
| Raised when the child process starts. More... | |
| RADCore::Event< void(int) > | finished |
| Raised with exit code when the child exits. More... | |
| RADCore::Event< void(std::string) > | errorOccurred |
| Raised when process start/wait/read fails. More... | |
Child process helper for stdout/stderr capture.
| RADCore::RADProcess::RADProcess | ( | ) |
Creates a non-running process.
|
override |
Kills or cleans up the process if needed.
| int RADCore::RADProcess::exitCode | ( | ) | const |
Returns exit code after finish.
| void RADCore::RADProcess::kill | ( | ) |
Sends a kill request to the process.
| std::string RADCore::RADProcess::readAllStandardError | ( | ) | const |
Returns captured stderr.
| std::string RADCore::RADProcess::readAllStandardOutput | ( | ) | const |
Returns captured stdout.
| bool RADCore::RADProcess::start | ( | const std::string & | program, |
| const std::vector< std::string > & | arguments = {} |
||
| ) |
Starts program with arguments.
| ProcessState RADCore::RADProcess::state | ( | ) | const |
Returns process state.
| bool RADCore::RADProcess::waitForFinished | ( | int | timeoutMs = -1 | ) |
Waits for process exit; timeoutMs < 0 waits indefinitely.
| RADCore::Event<void (std::string) > RADCore::RADProcess::errorOccurred |
Raised when process start/wait/read fails.
| RADCore::Event<void (int) > RADCore::RADProcess::finished |
Raised with exit code when the child exits.
| RADCore::Event<void () > RADCore::RADProcess::started |
Raised when the child process starts.