open3

Capture Child Process I/O

Functions

FunctionDescription
_o3_pipe
_o3_fork
_o3_dup2
_o3_close
_o3_execve
_o3_exit
_o3_read
_o3_write
_o3_wait4
open3_popenSpawn command with piped stdin/stdout/stderr. cmd = path to executable (null-…
open3_pidGet child PID.
open3_writeWrite data to child’s stdin.
open3_readRead from child’s stdout.
open3_read_errRead from child’s stderr.
open3_close_stdinClose child’s stdin (signals EOF to child).
open3_waitWait for child to exit. Returns exit code (0-255) or -1 on error.
open3_capture2Run command and capture stdout. Returns bytes read.
open3_capture3Run command and capture stdout + stderr. Returns stdout bytes read.

Details

_o3_pipe

fn _o3_pipe(fds: &i64) -> i64

_o3_fork

fn _o3_fork() -> i64

_o3_dup2

fn _o3_dup2(old: i64, new_fd: i64) -> i64

_o3_close

fn _o3_close(fd: i64) -> i64

_o3_execve

fn _o3_execve(path: &i8, argv: &i64, envp: &i64) -> i64

_o3_exit

fn _o3_exit(code: i64)

_o3_read

fn _o3_read(fd: i64, buf: &i8, max: i64) -> i64

_o3_write

fn _o3_write(fd: i64, data: &i8, len: i64) -> i64

_o3_wait4

fn _o3_wait4(pid: i64, status: &i64) -> i64

open3_popen

fn open3_popen(cmd: &i8, argv: &i64) -> &i64

Spawn command with piped stdin/stdout/stderr. cmd = path to executable (null-terminated). argv = null-terminated array of args (argv[0] = cmd name). Returns context pointer.

open3_pid

fn open3_pid(ctx: &i64) -> i64

Get child PID.

open3_write

fn open3_write(ctx: &i64, data: &i8, len: i64) -> i64

Write data to child’s stdin.

open3_read

fn open3_read(ctx: &i64, buf: &i8, max: i64) -> i64

Read from child’s stdout.

open3_read_err

fn open3_read_err(ctx: &i64, buf: &i8, max: i64) -> i64

Read from child’s stderr.

open3_close_stdin

fn open3_close_stdin(ctx: &i64)

Close child’s stdin (signals EOF to child).

open3_wait

fn open3_wait(ctx: &i64) -> i64

Wait for child to exit. Returns exit code (0-255) or -1 on error.

open3_capture2

fn open3_capture2(cmd: &i8, argv: &i64, out: &i8, max: i64) -> i64

Run command and capture stdout. Returns bytes read.

open3_capture3

fn open3_capture3(cmd: &i8, argv: &i64, out: &i8, omax: i64, err: &i8, emax: i64) -> i64

Run command and capture stdout + stderr. Returns stdout bytes read.