#[cfg(any(
target_vendor = "apple",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "dragonfly",
))]
fn main() -> std::io::Result<()> {
use std::process::Command;
use async_io::os::kqueue::{Exit, Filter};
use futures_lite::future;
future::block_on(async {
let process = Command::new("sleep")
.arg("3")
.spawn()
.expect("failed to spawn process");
let process = Filter::new(Exit::new(process))?;
process.ready().await?;
Ok(())
})
}
#[cfg(not(any(
target_vendor = "apple",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "dragonfly",
)))]
fn main() {
println!("This example only works for kqueue-enabled platforms.");
}