@@ -21,16 +21,17 @@ pub trait CommandStdInExt {
21
21
/// use std::process::Command;
22
22
///
23
23
/// Command::new("cat")
24
+ /// .arg("-A")
24
25
/// .with_stdin("42")
25
26
/// .unwrap();
26
27
/// ```
27
- fn with_stdin < S > ( self , buffer : S ) -> StdInCommand
28
+ fn with_stdin < S > ( & mut self , buffer : S ) -> StdInCommand
28
29
where
29
30
S : Into < Vec < u8 > > ;
30
31
}
31
32
32
33
impl CommandStdInExt for process:: Command {
33
- fn with_stdin < S > ( self , buffer : S ) -> StdInCommand
34
+ fn with_stdin < S > ( & mut self , buffer : S ) -> StdInCommand
34
35
where
35
36
S : Into < Vec < u8 > > ,
36
37
{
@@ -57,12 +58,12 @@ impl CommandStdInExt for process::Command {
57
58
/// .unwrap();
58
59
/// ```
59
60
#[ derive( Debug ) ]
60
- pub struct StdInCommand {
61
- cmd : process:: Command ,
61
+ pub struct StdInCommand < ' a > {
62
+ cmd : & ' a mut process:: Command ,
62
63
stdin : Vec < u8 > ,
63
64
}
64
65
65
- impl StdInCommand {
66
+ impl < ' a > StdInCommand < ' a > {
66
67
/// Executes the command as a child process, waiting for it to finish and collecting all of its
67
68
/// output.
68
69
///
@@ -97,7 +98,7 @@ impl StdInCommand {
97
98
}
98
99
}
99
100
100
- impl < ' c > OutputOkExt for & ' c mut StdInCommand {
101
+ impl < ' c , ' a > OutputOkExt for & ' c mut StdInCommand < ' a > {
101
102
fn ok ( self ) -> OutputResult {
102
103
let output = self . output ( ) . map_err ( OutputError :: with_cause) ?;
103
104
if output. status . success ( ) {
@@ -123,7 +124,7 @@ impl<'c> OutputOkExt for &'c mut StdInCommand {
123
124
}
124
125
}
125
126
126
- impl < ' c > OutputAssertExt for & ' c mut StdInCommand {
127
+ impl < ' c > OutputAssertExt for & ' c mut StdInCommand < ' c > {
127
128
fn assert ( self ) -> Assert {
128
129
let output = self . output ( ) . unwrap ( ) ;
129
130
Assert :: new ( output)
0 commit comments