rust/tests/ui/zombie_processes_fixable.fixed
2024-08-27 21:51:02 +02:00

27 lines
663 B
Rust

#![warn(clippy::zombie_processes)]
#![allow(clippy::needless_return)]
use std::process::{Child, Command};
fn main() {
let _ = Command::new("").spawn().unwrap().wait();
//~^ ERROR: spawned process is never `wait()`ed on
Command::new("").spawn().unwrap().wait();
//~^ ERROR: spawned process is never `wait()`ed on
spawn_proc().wait();
//~^ ERROR: spawned process is never `wait()`ed on
spawn_proc().wait().unwrap(); // OK
}
fn not_main() {
Command::new("").spawn().unwrap().wait();
}
fn spawn_proc() -> Child {
Command::new("").spawn().unwrap()
}
fn spawn_proc_2() -> Child {
return Command::new("").spawn().unwrap();
}