Skip to content

Commit 474f868

Browse files
author
Mingshen Sun
committed
Change with_stdin to &mut to fix #22
1 parent fdfbe66 commit 474f868

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/stdin.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ pub trait CommandStdInExt {
2424
/// .with_stdin("42")
2525
/// .unwrap();
2626
/// ```
27-
fn with_stdin<S>(self, buffer: S) -> StdInCommand
27+
fn with_stdin<S>(&mut self, buffer: S) -> StdInCommand
2828
where
2929
S: Into<Vec<u8>>;
3030
}
3131

3232
impl CommandStdInExt for process::Command {
33-
fn with_stdin<S>(self, buffer: S) -> StdInCommand
33+
fn with_stdin<S>(&mut self, buffer: S) -> StdInCommand
3434
where
3535
S: Into<Vec<u8>>,
3636
{
@@ -57,12 +57,12 @@ impl CommandStdInExt for process::Command {
5757
/// .unwrap();
5858
/// ```
5959
#[derive(Debug)]
60-
pub struct StdInCommand {
61-
cmd: process::Command,
60+
pub struct StdInCommand<'a> {
61+
cmd: &'a mut process::Command,
6262
stdin: Vec<u8>,
6363
}
6464

65-
impl StdInCommand {
65+
impl<'a> StdInCommand<'a> {
6666
/// Executes the command as a child process, waiting for it to finish and collecting all of its
6767
/// output.
6868
///
@@ -97,7 +97,7 @@ impl StdInCommand {
9797
}
9898
}
9999

100-
impl<'c> OutputOkExt for &'c mut StdInCommand {
100+
impl<'c, 'a> OutputOkExt for &'c mut StdInCommand<'a> {
101101
fn ok(self) -> OutputResult {
102102
let output = self.output().map_err(OutputError::with_cause)?;
103103
if output.status.success() {
@@ -123,7 +123,7 @@ impl<'c> OutputOkExt for &'c mut StdInCommand {
123123
}
124124
}
125125

126-
impl<'c> OutputAssertExt for &'c mut StdInCommand {
126+
impl<'c> OutputAssertExt for &'c mut StdInCommand<'c> {
127127
fn assert(self) -> Assert {
128128
let output = self.output().unwrap();
129129
Assert::new(output)

0 commit comments

Comments
 (0)