Function in io compiler

stdin

fn stdin() -> Stream
Import
use io::{stdin};
Source: compiler/src/builtin_docs/io.hy

Returns a new stream on the process’s standard input.

The stream holds a duplicated descriptor, so closing it does not close the process’s stdin. Like every stream it is non-blocking: read returns Err(IoError::WouldBlock) until input is available. Use io::sync::read_line or read_to_end to wait for input.

Returns#

Stream

Examples#

use io::{close, stdin};
use tests::assert;
let s = stdin();
let closed = match close(s) {
    Result::Ok(_) => true,
    Result::Err(_) => false,
};
assert!(closed);

See also#

  • io::read
  • io::sync::read_line
  • 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