Skip to content

Commit

Permalink
process: Add as_std() method to Command
Browse files Browse the repository at this point in the history
* This allows callers to cheaply convert to a &std::process::Command and
  use any (immutable) methods added on the stdlib type in case they are
  missing from our own wrapper (e.g. because MSRV is lagging)
  • Loading branch information
ipetkov committed Dec 2, 2021
1 parent 64da914 commit b1ea12e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tokio/src/process/mod.rs
Expand Up @@ -264,6 +264,12 @@ impl Command {
Self::from(StdCommand::new(program))
}

/// Cheaply convert to a `&std::process::Command` for places where the type from the standard
/// library is expected.
pub fn as_std(&self) -> &StdCommand {
&self.std
}

/// Adds an argument to pass to the program.
///
/// Only one argument can be passed per use. So instead of:
Expand Down

0 comments on commit b1ea12e

Please sign in to comment.