|
| Result | waitForExitSync () |
| | Waits (blocking) for process to exit after launch. It can only be called if Process::launch succeeded.
|
| |
| template<typename Out = StdOut, typename In = StdIn, typename Err = StdErr> |
| Result | launch (Span< const StringSpan > cmd, Out &&stdOut=Out(), In &&stdIn=In(), Err &&stdErr=Err()) |
| | Launch child process with the given arguments.
|
| |
| template<typename Out = StdOut, typename In = StdIn, typename Err = StdErr> |
| Result | exec (Span< const StringSpan > cmd, Out &&stdOut=Out(), In &&stdIn=In(), Err &&stdErr=Err()) |
| | Executes a child process with the given arguments, waiting (blocking) until it's fully finished.
|
| |
| int32_t | getExitStatus () const |
| | gets the return code from the exited child process (valid only after exec or waitForExitSync)
|
| |
| Result | setWorkingDirectory (StringSpan processWorkingDirectory) |
| | Sets the starting working directory of the process that will be launched / executed.
|
| |
| void | inheritParentEnvironmentVariables (bool inherit) |
| | Controls if the newly spawned child process will inherit parent process environment variables.
|
| |
| Result | setEnvironment (StringSpan environmentVariable, StringSpan value) |
| | Sets the environment variable for the newly spawned child process.
|
| |
| | Process (Span< native_char_t > commandMemory={}, Span< native_char_t > environmentMemory={}) |
| | Constructs a Process object passing (optional) memory storage for command and environment variables.
|
| |
Execute a child process with standard file descriptors redirection.
Features:
- Redirect standard in/out/err of a child process to a Pipe
- Inherit child process file descriptors from parent process
- Ignore (silence) child process standard file descriptor
- Wait for the child process exit code
Example: execute child process (launch and wait for it to fully execute)
Example: execute child process, redirecting stdout to a string
Example: launch a child process and wait for it to finish execution
Process process(commandArena.toSpan(), environmentArena.toSpan());
Example: execute child process, filling its stdin with a StringSpan
Example: read process output using a pipe, using launch + waitForExitSync
SC_TRY(process.
launch({
"executable.exe",
"--argument1",
"--argument2"}, outputPipe));
String output = StringEncoding::Ascii;
Example: Add an environment variable
Process process(commandArena.toSpan(), environmentArena.toSpan());
Example: Redefine an environment variable
Process process(commandArena.toSpan(), environmentArena.toSpan());
Example: Disable environment variable inheritance
Process process(commandArena.toSpan(), environmentArena.toSpan());