Process module

write_to_process

procedureSource

Writes data to the child's standard input and returns (success, bytes_written). It waits until the pipe has taken everything. It fails with the number of bytes that did go in when the pipe is closed, or the child has closed its end. Empty data succeeds with 0.

write_to_process :: (
    process: *Process,
    data: [] u8
) -> (success: bool, bytes_written: int)

Parameters

process: *Process
data: [] u8

Returns

success: bool
bytes_written: int
Example
process: Process;
assert(create_process(*process, "cmd.exe", "/c", "exit 0", capture_and_return_output = true));
defer deinit(*process);
ok, written := write_to_process(*process, .[]);
assert(ok && written == 0);

Doesn't run in the browser (only on windows).

See also