From b5ff8a1a75c4802a4f078bd4f912c07b2d956c47 Mon Sep 17 00:00:00 2001 From: TD-Sky Date: Thu, 10 Oct 2024 10:06:21 +0800 Subject: [PATCH] feat: `Command::as_std/as_mut_std` --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 6d5af70..ecfa3a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1077,6 +1077,16 @@ impl Command { let child = Child::new(self); async { child?.output().await } } + + /// Cheaply convert to a `&std::process::Command` for places where the type from the standard library is expected. + pub fn as_std(&self) -> &std::process::Command { + &self.inner + } + + /// Cheaply convert to a `&mut std::process::Command` for places where the type from the standard library is expected. + pub fn as_mut_std(&mut self) -> &mut std::process::Command { + &mut self.inner + } } impl From for Command {