File tree 2 files changed +42
-1
lines changed
2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ impl Command {
339
339
/// ```
340
340
#[ stable( feature = "process" , since = "1.0.0" ) ]
341
341
pub fn status ( & mut self ) -> io:: Result < ExitStatus > {
342
- self . inner . spawn ( imp:: Stdio :: Inherit , false ) . map ( Child :: from_inner)
342
+ self . inner . spawn ( imp:: Stdio :: Inherit , true ) . map ( Child :: from_inner)
343
343
. and_then ( |mut p| p. wait ( ) )
344
344
}
345
345
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ use std:: env;
12
+ use std:: io;
13
+ use std:: io:: Write ;
14
+ use std:: process:: { Command , Stdio } ;
15
+
16
+ fn main ( ) {
17
+ let mut args = env:: args ( ) ;
18
+ let me = args. next ( ) . unwrap ( ) ;
19
+ let arg = args. next ( ) ;
20
+ match arg. as_ref ( ) . map ( |s| & s[ ..] ) {
21
+ None => {
22
+ let mut s = Command :: new ( & me)
23
+ . arg ( "a1" )
24
+ . stdin ( Stdio :: piped ( ) )
25
+ . spawn ( )
26
+ . unwrap ( ) ;
27
+ s. stdin . take ( ) . unwrap ( ) . write_all ( b"foo\n " ) . unwrap ( ) ;
28
+ let s = s. wait ( ) . unwrap ( ) ;
29
+ assert ! ( s. success( ) ) ;
30
+ }
31
+ Some ( "a1" ) => {
32
+ let s = Command :: new ( & me) . arg ( "a2" ) . status ( ) . unwrap ( ) ;
33
+ assert ! ( s. success( ) ) ;
34
+ }
35
+ Some ( ..) => {
36
+ let mut s = String :: new ( ) ;
37
+ io:: stdin ( ) . read_line ( & mut s) . unwrap ( ) ;
38
+ assert_eq ! ( s, "foo\n " ) ;
39
+ }
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments