| 1 | //! A cat-like utility that can be used as a subprocess to test I/O |
|---|---|
| 2 | //! stream communication. |
| 3 | |
| 4 | use std::io; |
| 5 | use std::io::Write; |
| 6 | |
| 7 | fn main() { |
| 8 | let stdin = io::stdin(); |
| 9 | let mut stdout = io::stdout(); |
| 10 | let mut line = String::new(); |
| 11 | loop { |
| 12 | line.clear(); |
| 13 | stdin.read_line(&mut line).unwrap(); |
| 14 | if line.is_empty() { |
| 15 | break; |
| 16 | } |
| 17 | stdout.write_all(line.as_bytes()).unwrap(); |
| 18 | } |
| 19 | stdout.flush().unwrap(); |
| 20 | } |
| 21 |
