-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "tests: alter integration tests for stdio to not use a handrol…
- Loading branch information
Showing
3 changed files
with
17 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters