Import with #import "std/process_channel_linux".

ProcessChannel :: struct { socket: Socket.LinuxSocket; pid: s32; code: s32; exited: bool; error: s32; }
StartChannel :: (arguments: []string, merge_stderr: bool, discard_stderr: bool) -> ProcessChannel
ChannelSend :: (channel: ProcessChannel, input: []u8, timeout_ms: s32) -> s64
CloseChannelInput :: (channel: ProcessChannel) -> bool

End this child's input without closing its output. The caller may continue ChannelReceive and must still WaitChannel/CloseChannel. A second half-close is harmless while the channel remains open. Further sends safely fail.

ChannelReceive :: (channel: ProcessChannel, output: []u8, timeout_ms: s32) -> s64
WaitChannel :: (channel: *ProcessChannel, timeout_ms: s32) -> bool
CloseChannel :: (channel: *ProcessChannel, timeout_ms: s32) -> bool
CancelChannel :: (channel: *ProcessChannel) -> bool

Cancellation keeps the unreaped PID as proof of process-group ownership. Signal the group before WaitChannel can reap an already-exited parent whose descendant still owns stdout. Already joined channels only close their fd.

Source ↗ · All modules