Skip to content

Commit

Permalink
process: add Command::get_kill_on_drop()
Browse files Browse the repository at this point in the history
  • Loading branch information
czy-29 committed Jan 10, 2025
1 parent 6fc1a8c commit 2c040c0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tokio/src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2c040c0

Please sign in to comment.