process: Add support for stdio streams

This commit is contained in:
Andreas Rottmann
2019-06-24 16:56:47 -07:00
committed by Ivan Petkov
parent b16a8613b1
commit 849a5ad0b2
5 changed files with 197 additions and 4 deletions
+18
View File
@@ -0,0 +1,18 @@
// A cat-like utility that can be used as a subprocess to test I/O
// stream communication.
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();
if line.len() == 0 {
break;
}
stdout.write(line.as_bytes()).unwrap();
}
}