libnick 2025.1.0
A cross-platform base for native Nickvision applications.
|
A managed process. More...
#include <process.h>
Public Member Functions | |
Process (const std::filesystem::path &path, const std::vector< std::string > &args={}) | |
Constructs a Process. | |
~Process () | |
Destructs a Process. | |
const std::filesystem::path & | getPath () const |
Gets the path of the process. | |
Events::Event< ProcessExitedEventArgs > & | exited () |
Gets the event for when the process has exited. | |
bool | isRunning () const |
Gets whether or not the process is running. | |
bool | hasCompleted () const |
Gets whether or not the process has completed. | |
int | getExitCode () const |
Gets the exit code of the process. | |
const std::string & | getOutput () const |
Gets the console output of the process. | |
bool | start () |
Starts the process. | |
bool | kill () |
Kills the process. | |
int | waitForExit () |
Waits for the process to exit. | |
A managed process.
Nickvision::System::Process::Process | ( | const std::filesystem::path & | path, |
const std::vector< std::string > & | args = {} ) |
Constructs a Process.
path | The path of the process to execute |
args | The arguments to pass to the process |
std::runtime_error | Thrown if the process could not be created |
Nickvision::System::Process::~Process | ( | ) |
Destructs a Process.
This method will wait for the process to exit if it is still running.
Events::Event< ProcessExitedEventArgs > & Nickvision::System::Process::exited | ( | ) |
Gets the event for when the process has exited.
int Nickvision::System::Process::getExitCode | ( | ) | const |
Gets the exit code of the process.
const std::string & Nickvision::System::Process::getOutput | ( | ) | const |
Gets the console output of the process.
const std::filesystem::path & Nickvision::System::Process::getPath | ( | ) | const |
Gets the path of the process.
bool Nickvision::System::Process::hasCompleted | ( | ) | const |
Gets whether or not the process has completed.
bool Nickvision::System::Process::isRunning | ( | ) | const |
Gets whether or not the process is running.
bool Nickvision::System::Process::kill | ( | ) |
Kills the process.
bool Nickvision::System::Process::start | ( | ) |
Starts the process.
int Nickvision::System::Process::waitForExit | ( | ) |
Waits for the process to exit.
This function will block until the process has exited.
Make sure to call start() before calling this function.