process: skip the process_kill_on_drop test if bash is not installed. (#4079)

This commit is contained in:
Alan Somers 2021-08-29 02:59:58 -06:00 committed by GitHub
parent 98578a6f4a
commit b67d46403f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
#![cfg(all(unix, feature = "process"))]
#![warn(rust_2018_idioms)]
use std::io::ErrorKind;
use std::process::Stdio;
use std::time::Duration;
use tokio::io::AsyncReadExt;
@ -24,11 +25,12 @@ async fn kill_on_drop() {
",
]);
let mut child = cmd
.kill_on_drop(true)
.stdout(Stdio::piped())
.spawn()
.unwrap();
let e = cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn();
if e.is_err() && e.as_ref().unwrap_err().kind() == ErrorKind::NotFound {
println!("bash not available; skipping test");
return;
}
let mut child = e.unwrap();
sleep(Duration::from_secs(2)).await;