Bug 1443853 - Rename RunnerProcess::stop() to ::kill(). r?jgraham
This renames RunnerProcess::stop() to ::kill() for symmetry with
the standard library's std::process::Child.
MozReview-Commit-ID: 20vSni9bA0X
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -620,17 +620,17 @@ impl WebDriverHandler<GeckoExtensionRout
conn.close();
}
}
// If the browser is still open then kill the process
if let Some(ref mut runner) = self.browser {
if runner.running() {
info!("Forcing a shutdown of the browser process");
- if runner.stop().is_err() {
+ if runner.kill().is_err() {
error!("Failed to kill browser process");
};
}
}
self.connection = Mutex::new(None);
self.browser = None;
}
--- a/testing/mozbase/rust/mozrunner/src/runner.rs
+++ b/testing/mozbase/rust/mozrunner/src/runner.rs
@@ -42,20 +42,23 @@ pub trait Runner {
where
T: Into<Stdio>;
fn start(self) -> Result<Self::Process, RunnerError>;
}
pub trait RunnerProcess {
fn status(&mut self) -> IoResult<Option<process::ExitStatus>>;
- fn stop(&mut self) -> IoResult<process::ExitStatus>;
/// Determine if the process is still running.
fn running(&mut self) -> bool;
+
+ /// Forces the process to exit and returns the exit status. This is
+ /// equivalent to sending a SIGKILL on Unix platforms.
+ fn kill(&mut self) -> IoResult<process::ExitStatus>;
}
#[derive(Debug)]
pub enum RunnerError {
Io(IoError),
PrefReader(PrefReaderError),
}
@@ -108,17 +111,17 @@ impl RunnerProcess for FirefoxProcess {
fn status(&mut self) -> IoResult<Option<process::ExitStatus>> {
self.process.try_wait()
}
fn running(&mut self) -> bool {
self.status().unwrap().is_none()
}
- fn stop(&mut self) -> IoResult<process::ExitStatus> {
+ fn kill(&mut self) -> IoResult<process::ExitStatus> {
self.process.kill()?;
self.process.wait()
}
}
#[derive(Debug)]
pub struct FirefoxRunner {
binary: PathBuf,