diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 3077c4edc90..565795ac4e6 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -981,6 +981,26 @@ impl Command { async { child?.wait_with_output().await } } + + /// Returns the boolean value that was previously set by [`Command::kill_on_drop`]. + /// + /// Note that if you have not previously called [`Command::kill_on_drop`], the + /// default value of `false` will be returned here. + /// + /// # Examples + /// + /// ``` + /// use tokio::process::Command; + /// + /// let mut cmd = Command::new("echo"); + /// assert!(!cmd.get_kill_on_drop()); + /// + /// cmd.kill_on_drop(true); + /// assert!(cmd.get_kill_on_drop()); + /// ``` + pub fn get_kill_on_drop(&self) -> bool { + self.kill_on_drop + } } impl From for Command {