Skip to content

Commit

Permalink
print error message instead of just panicking.
Browse files Browse the repository at this point in the history
fs::remove_dir might panic if it cannot remove a file as happening when using --autoclean{,-expensive}

CC #22
  • Loading branch information
matthiaskrgr committed Dec 19, 2018
1 parent 18baebf commit 3783607
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ fn main() {
if config.is_present("dry-run") {
println!("would remove directory '{}'", dir.display());
} else {
fs::remove_dir_all(&dir).unwrap();
fs::remove_dir_all(&dir)
.unwrap_or_else(|_| panic!("Failed to remove file '{}'", dir.display()));
size_changed = true;
}
}
Expand Down

0 comments on commit 3783607

Please sign in to comment.