Closed
Description
What it does
If there is no wait on the Child handle(and/or before it goes out of scope, the destructor won't wait() it either.), generate a warning about possible consequences: zombie process.
Lint Name
process_child_not_waited
Category
No response
Advantage
No response
Drawbacks
None.
Example
thread::spawn(move || {
std::process::Command::new(&command[0])
.args(&command[1..])
.spawn()
.unwrap_or_else(|e| panic!("Failed to execute {}: {}", command.join(" "), e));
});
Could be written as:
thread::spawn(move || {
let child = std::process::Command::new(&command[0])
.args(&command[1..])
.spawn()
.unwrap_or_else(|e| panic!("Failed to execute {}: {}", command.join(" "), e));
child.wait();
});