Function in io compiler

capture_end

fn capture_end() -> (string, string)
Import
use io::{capture_end};
Source: compiler/src/builtin_docs/io.hy

Ends the innermost capture_begin() and returns what it kept, as (stdout, stderr). Both are empty when no capture is open.

Returns#

(string, string)

Examples#

use io::{capture_begin, capture_end, stderr, write};
use string::{to_bytes};
use tests::assert;
capture_begin();
let _ = write(stderr(), to_bytes("oops"));
let (_, err) = capture_end();
assert!(err == "oops");

See also#

  • io::capture_begin
  • 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.
  • open: Opens the file at path with mode and returns a stream on it.
  • close: Closes s.
  • read: Reads bytes from s into the front of buf without waiting.
  • write: Writes bytes from buf to s without waiting and returns how many were written.
↑ ↓ navigate ↵ open