Process module

read_from_process

procedure · 1 overloadSource

Waits up to timeout_ms for the child's output or error and reads what arrived into the two buffers: (success, output_bytes, error_bytes).

read_from_process :: (
    process: *Process,
    output_buffer: [] u8,
    error_buffer: [] u8,
    timeout_ms := -1
) -> (success: bool, output_bytes: int, error_bytes: int)

A timeout_ms of 0 only looks, and -1 (the default) waits for ever. Nothing arriving in time is a success with 0 and 0. Each call reads at most one buffer's worth from each pipe, so loop until process.output.eof and process.error.eof for all of it, and give the loop a time limit of its own.

Parameters

process: *Process
output_buffer: [] u8
error_buffer: [] u8
timeout_ms := -1

Returns

success: bool
output_bytes: int
error_bytes: int

See also