Skip to content

Commit

Permalink
Skip dirs on error
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed May 9, 2017
1 parent 10d113b commit 647eb35
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,18 @@ impl Scanner {
pub fn flush(&mut self) -> io::Result<()> {
let start_time = Instant::now();
while let Some((_, path)) = self.to_scan.pop() {
self.scan_dir(path)?;
if let Err(err) = self.scan_dir(&path) {
println!("Error scanning {}: {}", path.display(), err);
self.stats.skipped += 1;
}
}
self.flush_deferred()?;
let scan_duration = Instant::now().duration_since(start_time);
self.scan_listener.scan_over(&self, &self.stats, scan_duration);
Ok(())
}

fn scan_dir(&mut self, path: PathBuf) -> io::Result<()> {
fn scan_dir(&mut self, path: &PathBuf) -> io::Result<()> {
/// Errors are ignored here, since it's super common to find permission denied and unreadable symlinks,
/// and it'd be annoying if that aborted the whole operation.
// FIXME: store the errors somehow to report them in a controlled manner
Expand Down

0 comments on commit 647eb35

Please sign in to comment.