Import with #import "std/process_run_linux".

ProcessArgumentSlot :: struct { value: *u8; }
ProcessOptions :: struct { arguments: []string; directory: string; environment: []string; input_path: string; output_path: string; append_output: bool; error_path: string; merge_error: bool; capture_output: bool; new_session: bool; }
ProcessRun :: struct { pid: s32; code: s32; started: bool; finished: bool; output: Vec(u8); }
StartProcess :: (options: ProcessOptions, run: *ProcessRun) -> bool

Starts the child and leaves it running; capture_output is not available here, so a captured stream goes to output_path instead.

PollProcess :: (run: *ProcessRun) -> bool

Whether the child has finished, without waiting; its code is then set.

WaitProcess :: (run: *ProcessRun) -> bool

Waits for the child to finish and sets its code.

SignalProcess :: (run: *ProcessRun, signal_number: s32, whole_group: bool) -> bool

Sends a signal (15 asks to stop, 9 kills) to the child, or with whole_group to the process group a new_session child leads.

RunProcess :: (options: ProcessOptions, run: *ProcessRun) -> bool

Runs the child to completion. With capture_output its standard output is appended to run.output. False when it could not be started or waited for.

CatchTermination :: ()

After this, SIGTERM and SIGINT set TerminationRequested instead of ending the program, so it can stop its own children and clean up.

TerminationRequested :: () -> bool

Source ↗ · All modules