mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-07 00:00:09 +02:00
process: add Command::get_kill_on_drop() (#7086)
This commit is contained in:
@@ -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<StdCommand> for Command {
|
||||
|
||||
Reference in New Issue
Block a user