From 35e3b44c5d8eba6a747a3fab0c59df5f7aefa8f6 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Thu, 2 Dec 2021 11:02:26 -0800 Subject: [PATCH 1/4] process: Add `as_std()` method to `Command` * 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) --- tokio/src/process/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 6eeefdbef71..8a0d9db25fd 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: From ace99db1db05abaf51d06ff4bbdaaf7fd333726b Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Thu, 2 Dec 2021 11:37:18 -0800 Subject: [PATCH 2/4] Try to fix CI warning --- tokio/src/runtime/handle.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index ba9a9eaf7c3..dcfad1b357f 100644 --- a/tokio/src/runtime/handle.rs +++ b/tokio/src/runtime/handle.rs @@ -26,7 +26,10 @@ pub struct Handle { /// Handles to the signal drivers #[cfg_attr( - not(any(feature = "signal", all(unix, feature = "process"))), + not(any( + all(unix, feature = "signal"), + all(unix, feature = "process"), + )), allow(dead_code) )] pub(super) signal_handle: driver::SignalHandle, From 65fae6303a6982d6e46b53ef3ee8a64651167bc0 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Thu, 2 Dec 2021 11:39:52 -0800 Subject: [PATCH 3/4] fmt --- tokio/src/runtime/handle.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index dcfad1b357f..076a0ccf311 100644 --- a/tokio/src/runtime/handle.rs +++ b/tokio/src/runtime/handle.rs @@ -26,10 +26,7 @@ pub struct Handle { /// Handles to the signal drivers #[cfg_attr( - not(any( - all(unix, feature = "signal"), - all(unix, feature = "process"), - )), + not(any(all(unix, feature = "signal"), all(unix, feature = "process"))), allow(dead_code) )] pub(super) signal_handle: driver::SignalHandle, From c709e66d62703aeb06b460dcfac8212b7de90a66 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Thu, 2 Dec 2021 11:56:57 -0800 Subject: [PATCH 4/4] fix ci --- tokio/src/runtime/handle.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index 076a0ccf311..612205cccfa 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(all(unix, 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,