Bug 1443853 - Rename RunnerProcess::stop() to ::kill(). r?jgraham draft
authorAndreas Tolfsen <ato@sny.no>
Wed, 07 Mar 2018 21:29:23 +0000
changeset 765978 3ed0b4106633426b46bfbac903bcd8fd6cf51495
parent 765977 2d144822fc4cbede7481310e922477d372f009cf
child 765979 b162adc88b152f365d66be40377bb126c1baeda9
push id102198
push userbmo:ato@sny.no
push dateSun, 11 Mar 2018 16:03:30 +0000
reviewersjgraham
bugs1443853
milestone60.0a1
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
testing/geckodriver/src/marionette.rs
testing/mozbase/rust/mozrunner/src/runner.rs
--- 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,