From ee4b2ede83c661715c054d3cda170994a499c39f Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Thu, 2 Dec 2021 23:51:27 -0800 Subject: [PATCH] process: add `as_std()` method to `Command` (#4295) --- tokio/src/process/mod.rs | 6 ++++++ tokio/src/runtime/handle.rs | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 6eeefdbef..8a0d9db25 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -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: diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index ba9a9eaf7..612205ccc 100644 --- a/tokio/src/runtime/handle.rs +++ b/tokio/src/runtime/handle.rs @@ -26,7 +26,11 @@ pub struct Handle { /// Handles to the signal drivers #[cfg_attr( - not(any(feature = "signal", all(unix, feature = "process"))), + any( + loom, + not(all(unix, feature = "signal")), + not(all(unix, feature = "process")), + ), allow(dead_code) )] pub(super) signal_handle: driver::SignalHandle,