2019-08-19 19:42:54 -07:00
|
|
|
//! A cat-like utility that can be used as a subprocess to test I/O
|
|
|
|
|
//! stream communication.
|
|
|
|
|
|
2016-11-18 20:57:31 +01:00
|
|
|
use std::io;
|
|
|
|
|
use std::io::Write;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let stdin = io::stdin();
|
|
|
|
|
let mut stdout = io::stdout();
|
|
|
|
|
let mut line = String::new();
|
|
|
|
|
loop {
|
|
|
|
|
line.clear();
|
|
|
|
|
stdin.read_line(&mut line).unwrap();
|
2019-05-29 20:30:29 -07:00
|
|
|
if line.is_empty() {
|
2016-11-18 20:57:31 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2019-05-29 20:30:29 -07:00
|
|
|
stdout.write_all(line.as_bytes()).unwrap();
|
2016-11-18 20:57:31 +01:00
|
|
|
}
|
2016-12-04 18:47:48 +01:00
|
|
|
stdout.flush().unwrap();
|
2016-11-18 20:57:31 +01:00
|
|
|
}
|