Lyricdev
GitHub

class PipeReader

pub class PipeReader :: [Reader, Closeable]

Conforms to Reader, Closeable.

The parent's end of a child's output or error pipe: a Reader that waits until bytes come, and returns 0 once the child has closed its end.

Methods

pub mut fn read(into: Slice<uint8>): int throws [IoError, Cancelled]

Reads into into, waiting until bytes come, and returns how many; 0 at the end.

Errors

Throws IoError — Closed for a closed pipe —, and Cancelled when the waiting task is cancelled.

pub fn close(): void throws IoError

Closes the pipe; a task that waits in a read throws Closed. A second close does nothing.

Errors

Throws IoError when the system fails to close it.