From 39f67a9c6964d50428ca7a5b817d72d3c557e9ce Mon Sep 17 00:00:00 2001 From: Ross Mackay Date: Fri, 9 Aug 2024 00:08:11 +0100 Subject: [PATCH] feat: Implement `From` for `process::Command` Allows conversion with `process::Command::from(asserted_cmd)` --- src/cmd.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cmd.rs b/src/cmd.rs index 30e67ae..ebcfff6 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -18,7 +18,7 @@ use crate::output::OutputResult; /// [`std::process::Command`] customized for testing. #[derive(Debug)] pub struct Command { - cmd: process::Command, + pub cmd: process::Command, stdin: Option, timeout: Option, } @@ -508,6 +508,12 @@ impl From for Command { } } +impl From for process::Command { + fn from(cmd: Command) -> process::Command { + cmd.cmd + } +} + impl<'c> OutputOkExt for &'c mut Command { fn ok(self) -> OutputResult { let output = self.output().map_err(OutputError::with_cause)?;