@@ -19,7 +19,7 @@ use std::{
1919/// If `sort_by_size_in_bytes` is set, we will sort all sizes (ascending) before outputting them.
2020pub fn aggregate (
2121 mut out : impl io:: Write ,
22- mut err : impl io:: Write + Send + ' static ,
22+ err : Option < impl io:: Write + Send + ' static > ,
2323 walk_options : WalkOptions ,
2424 compute_total : bool ,
2525 sort_by_size_in_bytes : bool ,
@@ -36,19 +36,23 @@ pub fn aggregate(
3636 let mut inodes = InodeFilter :: default ( ) ;
3737 let paths: Vec < _ > = paths. into_iter ( ) . collect ( ) ;
3838 let shared_count = Arc :: new ( AtomicU64 :: new ( 0 ) ) ;
39- thread:: spawn ( {
40- let shared_count = Arc :: clone ( & shared_count) ;
41- thread:: sleep ( Duration :: from_secs ( 1 ) ) ;
42- move || loop {
43- thread:: sleep ( Duration :: from_millis ( 100 ) ) ;
44- write ! (
45- err,
46- "Enumerating {} entries\r " ,
47- shared_count. load( Ordering :: Relaxed )
48- )
49- . ok ( ) ;
50- }
51- } ) ;
39+
40+ if let Some ( mut err) = err {
41+ thread:: spawn ( {
42+ let shared_count = Arc :: clone ( & shared_count) ;
43+ thread:: sleep ( Duration :: from_secs ( 1 ) ) ;
44+ move || loop {
45+ thread:: sleep ( Duration :: from_millis ( 100 ) ) ;
46+ write ! (
47+ err,
48+ "Enumerating {} entries\r " ,
49+ shared_count. load( Ordering :: Relaxed )
50+ )
51+ . ok ( ) ;
52+ }
53+ } ) ;
54+ }
55+
5256 for path in paths. into_iter ( ) {
5357 num_roots += 1 ;
5458 let mut num_bytes = 0u128 ;
0 commit comments