diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-29 19:07:01 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-29 19:07:01 +0800 |
commit | 277824b2aeedfa1f82fa2675f17e2498230b9fe7 (patch) | |
tree | f372fd5a767c5ae4090a10b7e4cfadfc0a5c87cf /src/common.rs | |
parent | 8c3294e67c4a140be335816720d6c0e5d021319b (diff) |
Allow initial scan to be interrupted properly…
…which requires peeling through all the layers, but it's worth it.
Diffstat (limited to 'src/common.rs')
-rw-r--r-- | src/common.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common.rs b/src/common.rs index b405ec0..f88c491 100644 --- a/src/common.rs +++ b/src/common.rs @@ -189,3 +189,13 @@ pub struct WalkResult { /// The amount of io::errors we encountered. Can happen when fetching meta-data, or when reading the directory contents. pub num_errors: u64, } + +impl WalkResult { + pub fn to_exit_code(&self) -> i32 { + if self.num_errors > 0 { + 1 + } else { + 0 + } + } +} |