amber/stderr
Values
pub fn close() -> Result(Nil, error.Error)
Closes stderr, freeing the resource.
Examples
let assert Ok(_) = stderr.close()
pub fn is_terminal() -> Bool
Checks if stderr is a TTY (terminal).
Examples
// This example is system and context specific
stderr.is_terminal() // True
pub fn writable() -> writable_stream.WritableStream(
uint8_array.Uint8Array,
)
A writable stream interface to stderr.
pub fn write(
p: uint8_array.Uint8Array,
) -> promise.Promise(Result(Int, error.Error))
Write the contents of the array buffer (p) to stderr.
Resolves to the number of bytes written.
It is not guaranteed that the full buffer will be written in a single call.
Examples
let data = text_encoder.encode("Hello world")
use result <- promise.then(stderr.write(data))
let assert Ok(bytes_written) = result
// bytes_written == 11
pub fn write_sync(
p: uint8_array.Uint8Array,
) -> Result(Int, error.Error)
Synchronously write the contents of the array buffer (p) to stderr.
Returns the number of bytes written.
It is not guaranteed that the full buffer will be written in a single call.
Examples
let data = text_encoder.encode("Hello world")
let assert Ok(bytes_written) = stderr.write_sync(data)
// bytes_written == 11