Skip to content

Child Process

1 min read

Import: import system.process;

Read the process guide for launch settings, cancellation, and streaming ownership.

ChildProcess

Owns a child and its pipes; explicit close terminates and reaps unfinished work.

public class ChildProcess

stdout

Borrows stdout through an AsyncReader; retain this reader when using read_line buffering.

public get stdout(): ProcessReader

stderr

Borrows stderr through an AsyncReader; drain it concurrently with stdout.

public get stderr(): ProcessReader

stdin

Borrows stdin through an AsyncWriter; call close_stdin to deliver EOF to the child.

public get stdin(): ProcessWriter

close_stdin

Closes stdin after pending writes, allowing commands waiting for input EOF to finish.

public fun close_stdin(
    token: Option<CancellationToken> = Option.None
): Future<Result<Unit, ProcessError>>

wait

Waits for process exit without discarding unread output or closing the child handle.

public fun wait(token: Option<CancellationToken> = Option.None): Future<Result<int, ProcessError>>

close

Terminates and reaps the owned child; repeated or concurrent closes share the outcome.

public fun close(): Future<Result<Unit, ProcessError>>