diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-12 08:16:57 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-12 08:16:57 +0800 |
commit | 75b3eed98f14d918f474f73caa3cdedd5af927ad (patch) | |
tree | 7282ed99d1bb1ae9bdd7967317d1faaae8519438 /src/aggregate.rs | |
parent | 05e61a65e318694cfb2b98f9566bff817090d741 (diff) |
fix: broken or non-existing root path will still print the valid results. (#124)
Previously it would fail completely without printing anything.
Diffstat (limited to 'src/aggregate.rs')
-rw-r--r-- | src/aggregate.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/aggregate.rs b/src/aggregate.rs index 2b621d9..9a2c518 100644 --- a/src/aggregate.rs +++ b/src/aggregate.rs @@ -88,7 +88,15 @@ pub fn aggregate( num_roots += 1; let mut num_bytes = 0u128; let mut num_errors = 0u64; - let device_id = crossdev::init(path.as_ref())?; + let device_id = match crossdev::init(path.as_ref()) { + Ok(id) => id, + Err(_) => { + num_errors += 1; + res.num_errors += 1; + aggregates.push((path.as_ref().to_owned(), num_bytes, num_errors)); + continue; + } + }; for entry in walk_options.iter_from_path(path.as_ref()) { stats.entries_traversed += 1; progress.throttled(|out| { |