Bug 1575021 - [mozrunner] Don't kill an already exited process. r=webdriver-reviewers,jgraham

Differential Revision: https://phabricator.services.mozilla.com/D87736
This commit is contained in:
Henrik Skupin 2020-08-20 18:39:36 +00:00
parent ea75c31b4d
commit 7f58f5cde5

View File

@ -154,9 +154,19 @@ impl RunnerProcess for FirefoxProcess {
}
fn kill(&mut self) -> io::Result<process::ExitStatus> {
debug!("Killing process {}", self.process.id());
self.process.kill()?;
self.process.wait()
match self.try_wait() {
// child has already exited, reap its exit code
Ok(Some(status)) => return Ok(status),
// child still running, kill it
Ok(None) => {
debug!("Killing process {}", self.process.id());
self.process.kill()?;
return self.process.wait();
}
Err(e) => return Err(e),
}
}
}