@@ -138,10 +138,10 @@ impl GroupCmds {
138138 }
139139 }
140140
141- pub fn spawn ( mut self ) -> Result < CmdChildren > {
141+ pub fn spawn ( mut self , with_output : bool ) -> Result < CmdChildren > {
142142 assert_eq ! ( self . group_cmds. len( ) , 1 ) ;
143143 let mut cmds = self . group_cmds . pop ( ) . unwrap ( ) . 0 ;
144- let ret = cmds. spawn ( & mut self . current_dir ) ;
144+ let ret = cmds. spawn ( & mut self . current_dir , with_output ) ;
145145 if let Err ( ref err) = ret {
146146 error ! ( "Spawning {} failed, Error: {}" , cmds. get_full_cmds( ) , err) ;
147147 }
@@ -170,7 +170,7 @@ impl Cmds {
170170 & self . full_cmds
171171 }
172172
173- fn spawn ( & mut self , current_dir : & mut PathBuf ) -> Result < CmdChildren > {
173+ fn spawn ( & mut self , current_dir : & mut PathBuf , with_output : bool ) -> Result < CmdChildren > {
174174 if std:: env:: var ( "CMD_LIB_DEBUG" ) == Ok ( "1" . into ( ) ) {
175175 debug ! ( "Running {} ..." , self . get_full_cmds( ) ) ;
176176 }
@@ -189,19 +189,19 @@ impl Cmds {
189189 } else {
190190 cmd. setup_redirects ( & mut last_pipe_in, None ) ?;
191191 }
192- let child = cmd. spawn ( current_dir) ?;
192+ let child = cmd. spawn ( current_dir, with_output ) ?;
193193 children. push ( child) ;
194194 }
195195
196196 Ok ( CmdChildren :: from ( children) )
197197 }
198198
199199 fn run_cmd ( & mut self , current_dir : & mut PathBuf ) -> CmdResult {
200- self . spawn ( current_dir) ?. wait_cmd_result_nolog ( )
200+ self . spawn ( current_dir, false ) ?. wait_cmd_result_nolog ( )
201201 }
202202
203203 fn run_fun ( & mut self , current_dir : & mut PathBuf ) -> FunResult {
204- self . spawn ( current_dir) ?. wait_fun_result_nolog ( )
204+ self . spawn ( current_dir, true ) ?. wait_fun_result_nolog ( )
205205 }
206206}
207207
@@ -337,7 +337,7 @@ impl Cmd {
337337 self
338338 }
339339
340- fn spawn ( mut self , current_dir : & mut PathBuf ) -> Result < CmdChild > {
340+ fn spawn ( mut self , current_dir : & mut PathBuf , with_output : bool ) -> Result < CmdChild > {
341341 let arg0 = self . arg0 ( ) ;
342342 let full_cmd = self . debug_str ( ) ;
343343 if arg0 == "cd" {
@@ -411,7 +411,7 @@ impl Cmd {
411411 // update stdout
412412 if let Some ( redirect_out) = self . stdout_redirect . take ( ) {
413413 cmd. stdout ( redirect_out) ;
414- } else {
414+ } else if with_output {
415415 cmd. stdout ( Stdio :: piped ( ) ) ;
416416 }
417417
0 commit comments