Skip to content

Process Native

Spice
import "std/os/process_native";

Functions

spawnProcessAndWait

Spice
public f<int> spawnProcessAndWait(const String& program, const Vector<String>& args, bool captureOutput, bool includeStdErr, String& output)

Spawn a program, wait for it to terminate and optionally capture its output.

Parameters

Name Type Description
program const String& Name or path of the program
args const Vector<String>& Arguments for the program (without the program itself)
captureOutput bool Capture the standard output of the program
includeStdErr bool Capture the standard error stream as well (only if captureOutput is set)
output String& Captured output (output)

Returns: int — Exit code of the program, or PROCESS_SPAWN_FAILED if it could not be started