@@ -140,7 +140,7 @@ impl GroupCmds {
140140 pub fn spawn ( mut self ) -> Result < WaitCmd > {
141141 assert_eq ! ( self . group_cmds. len( ) , 1 ) ;
142142 let mut cmds = self . group_cmds . pop ( ) . unwrap ( ) . 0 ;
143- let ret = cmds. spawn ( & mut self . current_dir , false ) ;
143+ let ret = cmds. spawn ( & mut self . current_dir ) ;
144144 if let Err ( ref err) = ret {
145145 error ! ( "Spawning {} failed, Error: {}" , cmds. get_full_cmds( ) , err) ;
146146 }
@@ -150,7 +150,7 @@ impl GroupCmds {
150150 pub fn spawn_with_output ( mut self ) -> Result < WaitFun > {
151151 assert_eq ! ( self . group_cmds. len( ) , 1 ) ;
152152 let mut cmds = self . group_cmds . pop ( ) . unwrap ( ) . 0 ;
153- match cmds. spawn ( & mut self . current_dir , true ) {
153+ match cmds. spawn ( & mut self . current_dir ) {
154154 Ok ( ret) => Ok ( WaitFun ( ret. 0 ) ) ,
155155 Err ( err) => {
156156 error ! ( "Spawning {} failed, Error: {}" , cmds. get_full_cmds( ) , err) ;
@@ -181,7 +181,7 @@ impl Cmds {
181181 & self . full_cmds
182182 }
183183
184- fn spawn ( & mut self , current_dir : & mut String , with_output : bool ) -> Result < WaitCmd > {
184+ fn spawn ( & mut self , current_dir : & mut String ) -> Result < WaitCmd > {
185185 if std:: env:: var ( "CMD_LIB_DEBUG" ) == Ok ( "1" . into ( ) ) {
186186 debug ! ( "Running {} ..." , self . get_full_cmds( ) ) ;
187187 }
@@ -200,19 +200,19 @@ impl Cmds {
200200 } else {
201201 cmd. setup_redirects ( & mut last_pipe_in, None ) ?;
202202 }
203- let child = cmd. spawn ( current_dir, with_output ) ?;
203+ let child = cmd. spawn ( current_dir) ?;
204204 children. push ( child) ;
205205 }
206206
207207 Ok ( WaitCmd ( children) )
208208 }
209209
210210 fn run_cmd ( & mut self , current_dir : & mut String ) -> CmdResult {
211- self . spawn ( current_dir, false ) ?. wait_result_nolog ( )
211+ self . spawn ( current_dir) ?. wait_result_nolog ( )
212212 }
213213
214214 fn run_fun ( & mut self , current_dir : & mut String ) -> FunResult {
215- WaitFun ( self . spawn ( current_dir, true ) ?. 0 ) . wait_result_nolog ( )
215+ WaitFun ( self . spawn ( current_dir) ?. 0 ) . wait_result_nolog ( )
216216 }
217217}
218218
@@ -439,7 +439,7 @@ impl Cmd {
439439 }
440440 }
441441
442- fn spawn ( mut self , current_dir : & mut String , with_output : bool ) -> Result < CmdChild > {
442+ fn spawn ( mut self , current_dir : & mut String ) -> Result < CmdChild > {
443443 let arg0 = self . arg0 ( ) ;
444444 let full_cmd = self . debug_str ( ) ;
445445 if arg0 == "cd" {
@@ -463,12 +463,10 @@ impl Cmd {
463463 } ,
464464 stdout : if let Some ( redirect_out) = self . stdout_redirect . take ( ) {
465465 redirect_out
466- } else if with_output {
466+ } else {
467467 let ( pipe_reader, pipe_writer) = os_pipe:: pipe ( ) ?;
468468 new_pipe_out = Some ( pipe_reader) ;
469469 CmdOut :: CmdPipe ( pipe_writer)
470- } else {
471- CmdOut :: CmdPipe ( os_pipe:: dup_stdout ( ) ?)
472470 } ,
473471 stderr : if let Some ( redirect_err) = self . stderr_redirect . take ( ) {
474472 redirect_err
@@ -510,7 +508,7 @@ impl Cmd {
510508 // update stdout
511509 if let Some ( redirect_out) = self . stdout_redirect . take ( ) {
512510 cmd. stdout ( redirect_out) ;
513- } else if with_output {
511+ } else {
514512 cmd. stdout ( Stdio :: piped ( ) ) ;
515513 }
516514
0 commit comments