mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-20 00:00:08 +02:00
This fixes #4801, where, as a result of https://github.com/rust-lang/rust/pull/95469, our implementation of cat used for this test no longer works, as stdio functions on windows now can abort the process if the pipe is set to nonblocking mode. Unfortunately in windows, setting one end of the pipe to be nonblocking makes the whole thing nonblocking, so when, in tokio::process we set the child pipes to nonblocking mode, it causes serious problems for any rust program at the other end. Fixing this issue is for another day, but fixing the tests is for today.
15 lines
368 B
Rust
15 lines
368 B
Rust
//! A cat-like utility that can be used as a subprocess to test I/O
|
|
//! stream communication.
|
|
|
|
use tokio::io::AsyncWriteExt;
|
|
|
|
#[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();
|
|
}
|