Skip to content

Commit 6bd3be2

Browse files
authored
process: add Command::get_kill_on_drop() (#7086)
1 parent 6fc1a8c commit 6bd3be2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tokio/src/process/mod.rs

+20
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,26 @@ impl Command {
981981

982982
async { child?.wait_with_output().await }
983983
}
984+
985+
/// Returns the boolean value that was previously set by [`Command::kill_on_drop`].
986+
///
987+
/// Note that if you have not previously called [`Command::kill_on_drop`], the
988+
/// default value of `false` will be returned here.
989+
///
990+
/// # Examples
991+
///
992+
/// ```
993+
/// use tokio::process::Command;
994+
///
995+
/// let mut cmd = Command::new("echo");
996+
/// assert!(!cmd.get_kill_on_drop());
997+
///
998+
/// cmd.kill_on_drop(true);
999+
/// assert!(cmd.get_kill_on_drop());
1000+
/// ```
1001+
pub fn get_kill_on_drop(&self) -> bool {
1002+
self.kill_on_drop
1003+
}
9841004
}
9851005

9861006
impl From<StdCommand> for Command {

0 commit comments

Comments
 (0)