pub async fn build_bin() { std::process::Command::new("cargo") .arg("build") .arg("--bin") .arg("nats-server") .spawn() .unwrap() .wait() .unwrap(); } pub struct NatsServer(std::process::Child); impl Drop for NatsServer { fn drop(&mut self) { self.0.kill().unwrap(); } } pub async fn boot_bin() -> NatsServer { std::process::Command::new("killall") .arg("nats-server") .spawn() .unwrap() .wait() .unwrap(); let child = std::process::Command::new("./target/debug/nats-server") .env("RUST_LOG", "debug") .spawn() .unwrap(); tokio::time::sleep(tokio::time::Duration::from_millis(600)).await; NatsServer(child) }