stdout/
stdout.rs

1use std::io::Read;
2use std::process::Stdio;
3
4fn main() {
5    procspawn::init();
6
7    let mut builder = procspawn::Builder::new();
8    builder.stdout(Stdio::piped());
9
10    let mut handle = builder.spawn((1, 2), |(a, b)| {
11        println!("{:?} {:?}", a, b);
12    });
13
14    let mut s = String::new();
15    handle.stdout().unwrap().read_to_string(&mut s).unwrap();
16    assert_eq!(s, "1 2\n");
17}