Revert "tests: alter integration tests for stdio to not use a handrolled cat implementation (#4803)" (#4854)

This reverts commit d8cad13fd9.
This commit is contained in:
Ivan Petkov
2022-07-23 16:27:35 -07:00
committed by GitHub
parent 62593be261
commit 94a7eaed51
3 changed files with 17 additions and 23 deletions
+15 -9
View File
@@ -1,14 +1,20 @@
//! A cat-like utility that can be used as a subprocess to test I/O
//! stream communication.
use tokio::io::AsyncWriteExt;
use std::io;
use std::io::Write;
#[tokio::main(flavor = "current_thread")]
async fn main() {
let mut stdin = tokio::io::stdin();
let mut stdout = tokio::io::stdout();
tokio::io::copy(&mut stdin, &mut stdout).await.unwrap();
stdout.flush().await.unwrap();
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.is_empty() {
break;
}
stdout.write_all(line.as_bytes()).unwrap();
}
stdout.flush().unwrap();
}