File tree Expand file tree Collapse file tree 4 files changed +8
-12
lines changed Expand file tree Collapse file tree 4 files changed +8
-12
lines changed Original file line number Diff line number Diff line change 1515//! [INFO ] Total bandwidth: 1.11 GiB/s
1616//! ```
1717use byte_unit:: Byte ;
18+ use clap:: Parser ;
1819use cmd_lib:: * ;
1920use rayon:: prelude:: * ;
2021use std:: time:: Instant ;
21- use clap:: Parser ;
2222
2323const DATA_SIZE : u64 = 10 * 1024 * 1024 * 1024 ; // 10GB data
2424
Original file line number Diff line number Diff line change @@ -354,14 +354,10 @@ impl StderrThread {
354354 . lines ( )
355355 . map_while ( Result :: ok)
356356 . for_each ( |line| {
357- if !capture {
358- info ! ( "{line}" ) ;
359- } else {
360- if !output. is_empty ( ) {
361- output. push ( '\n' ) ;
362- }
363- output. push_str ( & line) ;
357+ if !output. is_empty ( ) {
358+ output. push ( '\n' ) ;
364359 }
360+ output. push_str ( & line) ;
365361 } ) ;
366362 return output;
367363 }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ use std::ffi::{OsStr, OsString};
1111use std:: fmt;
1212use std:: fs:: { File , OpenOptions } ;
1313use std:: io:: { Error , ErrorKind , Result } ;
14+ use std:: mem:: take;
1415use std:: path:: { Path , PathBuf } ;
1516use std:: process:: Command ;
1617use std:: sync:: Mutex ;
@@ -160,7 +161,7 @@ impl GroupCmds {
160161#[ doc( hidden) ]
161162#[ derive( Default ) ]
162163pub struct Cmds {
163- cmds : Vec < Option < Cmd > > ,
164+ cmds : Vec < Cmd > ,
164165 full_cmds : String ,
165166 ignore_error : bool ,
166167 file : String ,
@@ -188,7 +189,7 @@ impl Cmds {
188189 ) ;
189190 }
190191 }
191- self . cmds . push ( Some ( cmd) ) ;
192+ self . cmds . push ( cmd) ;
192193 self
193194 }
194195
@@ -204,8 +205,7 @@ impl Cmds {
204205 let mut children: Vec < CmdChild > = Vec :: new ( ) ;
205206 let len = self . cmds . len ( ) ;
206207 let mut prev_pipe_in = None ;
207- for ( i, cmd_opt) in self . cmds . iter_mut ( ) . enumerate ( ) {
208- let mut cmd = cmd_opt. take ( ) . unwrap ( ) ;
208+ for ( i, mut cmd) in take ( & mut self . cmds ) . into_iter ( ) . enumerate ( ) {
209209 if i != len - 1 {
210210 // not the last, update redirects
211211 let ( pipe_reader, pipe_writer) =
You can’t perform that action at this time.
0 commit comments