Search results

There are no results.

std.sys.Stderr

class pub Stderr

The standard error output stream.

Static methods

new

Show source code
Hide source code
fn pub static new(process: ref ChildProcess) -> Stderr {
  Stderr(process)
}
fn pub static new(process: ref ChildProcess) -> Stderr

Instance methods

read

Show source code
Hide source code
fn pub mut read(into: mut ByteArray, size: Int) -> Result[Int, Error] {
  match
    inko_child_process_stderr_read(_INKO.process, @process.raw, into, size)
  {
    case { @tag = 0, @value = v } -> Result.Ok(v)
    case { @tag = _, @value = e } -> Result.Error(Error.from_os_error(e))
  }
}
fn pub mut read(into: mut ByteArray, size: Int) -> Result[Int, Error]

Reads bytes from a stream into a ByteArray.

The return value is the number of bytes read.

The size argument specifies how many bytes are to be read. The actual number of bytes read may be less than this value.

read_all

Show source code
Hide source code
fn pub mut read_all(bytes: mut ByteArray) -> Result[Int, Error] {
  let mut total = 0
  let mut read_size = INITIAL_READ_ALL_SIZE

  loop {
    let bytes_read = try read(into: bytes, size: read_size)

    if bytes_read == 0 { return Result.Ok(total) }

    total += bytes_read

    # To reduce the overhead of large buffer reads, we increase the buffer
    # size as more data is read.
    if read_size < MAX_READ_ALL_SIZE { read_size *= 2 }
  }
}
fn pub mut read_all(bytes: mut ByteArray) -> Result[Int, Error]

Reads all bytes from the stream into the ByteArray.

If an error is encountered while reading, this method stops reading any more bytes and re-throws the error.

The return value is the number of bytes read.

Implemented traits

std.drop.

Drop

impl Drop for Stderr
std.io.

Read

impl Read for Stderr