Skip to content

Commit

Permalink
feat: Implement From<assert:cmd::Command> for process::Command
Browse files Browse the repository at this point in the history
Allows conversion with `process::Command::from(asserted_cmd)`
  • Loading branch information
mcky committed Aug 8, 2024
1 parent 4d3dbd3 commit 39f67a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bstr::BString>,
timeout: Option<std::time::Duration>,
}
Expand Down Expand Up @@ -508,6 +508,12 @@ impl From<process::Command> for Command {
}
}

impl From<Command> 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)?;
Expand Down

0 comments on commit 39f67a9

Please sign in to comment.