Function in io compiler

wait_writable

fn wait_writable(Stream s) -> Result<unit, IoError>
Import
use io::{wait_writable};
Source: compiler/src/builtin_docs/io.hy

Waits until s is writable.

Returns at once when the stream can take more data. Inside a task only that task waits while the others run; elsewhere the program waits. Returns Err(IoError::TimedOut) when the stream’s write timeout passes and Err(IoError::AlreadyClosed) on a closed stream. await_writable is an older name for the same function.

Parameters#

NameType
sStream

Returns#

Result<unit, IoError>

Examples#

use io::{stdout, wait_writable};
use tests::assert;
let ready = match wait_writable(stdout()) {
    Result::Ok(_) => true,
    Result::Err(_) => false,
};
assert!(ready);

See also#

  • io::await_writable
  • stdin: Returns a new stream on the process’s standard input.
  • stdout: Returns a new stream on the process’s standard output.
  • stderr: Returns a new stream on the process’s standard error.
  • capture_begin: Starts keeping this thread’s stdout and stderr writes in memory instead of writing them, until the matching capture_end().
  • capture_end: Ends the innermost capture_begin() and returns what it kept, as (stdout, stderr).
  • open: Opens the file at path with mode and returns a stream on it.
  • close: Closes s.
↑ ↓ navigate ↵ open