#![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
#![cfg(all(unix, not(target_os = "freebsd")))]
use std::process::Stdio;
use tokio::{process::Command, runtime::Runtime};
#[test]
fn process_spawned_and_wait_in_different_runtime() {
let mut child = Runtime::new().unwrap().block_on(async {
Command::new("true")
.stdin(Stdio::piped())
.stdout(Stdio::null())
.spawn()
.unwrap()
});
Runtime::new().unwrap().block_on(async {
let _ = child.wait().await.unwrap();
});
}
#[test]
#[should_panic(
expected = "there is no reactor running, must be called from the context of a Tokio 1.x runtime"
)]
fn process_spawned_outside_runtime() {
let _ = Command::new("true")
.stdin(Stdio::piped())
.stdout(Stdio::null())
.spawn();
}