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 15
15
//! [INFO ] Total bandwidth: 1.11 GiB/s
16
16
//! ```
17
17
use byte_unit:: Byte ;
18
+ use clap:: Parser ;
18
19
use cmd_lib:: * ;
19
20
use rayon:: prelude:: * ;
20
21
use std:: time:: Instant ;
21
- use clap:: Parser ;
22
22
23
23
const DATA_SIZE : u64 = 10 * 1024 * 1024 * 1024 ; // 10GB data
24
24
Original file line number Diff line number Diff line change @@ -354,14 +354,10 @@ impl StderrThread {
354
354
. lines ( )
355
355
. map_while ( Result :: ok)
356
356
. 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' ) ;
364
359
}
360
+ output. push_str ( & line) ;
365
361
} ) ;
366
362
return output;
367
363
}
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ use std::ffi::{OsStr, OsString};
11
11
use std:: fmt;
12
12
use std:: fs:: { File , OpenOptions } ;
13
13
use std:: io:: { Error , ErrorKind , Result } ;
14
+ use std:: mem:: take;
14
15
use std:: path:: { Path , PathBuf } ;
15
16
use std:: process:: Command ;
16
17
use std:: sync:: Mutex ;
@@ -160,7 +161,7 @@ impl GroupCmds {
160
161
#[ doc( hidden) ]
161
162
#[ derive( Default ) ]
162
163
pub struct Cmds {
163
- cmds : Vec < Option < Cmd > > ,
164
+ cmds : Vec < Cmd > ,
164
165
full_cmds : String ,
165
166
ignore_error : bool ,
166
167
file : String ,
@@ -188,7 +189,7 @@ impl Cmds {
188
189
) ;
189
190
}
190
191
}
191
- self . cmds . push ( Some ( cmd) ) ;
192
+ self . cmds . push ( cmd) ;
192
193
self
193
194
}
194
195
@@ -204,8 +205,7 @@ impl Cmds {
204
205
let mut children: Vec < CmdChild > = Vec :: new ( ) ;
205
206
let len = self . cmds . len ( ) ;
206
207
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 ( ) {
209
209
if i != len - 1 {
210
210
// not the last, update redirects
211
211
let ( pipe_reader, pipe_writer) =
You can’t perform that action at this time.
0 commit comments