#![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
#![cfg(all(unix, not(target_os = "freebsd")))]
use std::process::Stdio;
use std::time::Duration;
use tokio::io::AsyncWriteExt;
use tokio::process::Command;
use tokio::time;
use tokio_test::assert_err;
#[tokio::test]
#[cfg_attr(panic = "abort", ignore)]
async fn issue_2174() {
let mut child = Command::new("sleep")
.arg("2")
.stdin(Stdio::piped())
.stdout(Stdio::null())
.spawn()
.unwrap();
let mut input = child.stdin.take().unwrap();
let handle = tokio::spawn(async move {
let data = [0u8; 8192];
loop {
input.write_all(&data).await.unwrap();
}
});
time::sleep(Duration::from_secs(1)).await;
child.kill().await.unwrap();
assert_err!(handle.await);
}