Return Ok on kill if process has already exited
This commit is contained in:
@@ -719,12 +719,9 @@ impl Process {
|
||||
pub fn kill(&mut self) -> io::Result<()> {
|
||||
// If we've already waited on this process then the pid can be recycled
|
||||
// and used for another process, and we probably shouldn't be killing
|
||||
// random processes, so just return an error.
|
||||
// random processes, so return Ok because the process has exited already.
|
||||
if self.status.is_some() {
|
||||
Err(io::const_io_error!(
|
||||
ErrorKind::InvalidInput,
|
||||
"invalid argument: can't kill an exited process",
|
||||
))
|
||||
Ok(())
|
||||
} else {
|
||||
cvt(unsafe { libc::kill(self.pid, libc::SIGKILL) }).map(drop)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user