Clean up any partial buries due to permission error

This commit is contained in:
Kevin Liu 2016-10-21 01:33:16 -07:00
parent 4a228e0e59
commit 0e373be6de

View file

@ -213,6 +213,8 @@ Send files to the graveyard (/tmp/.graveyard) instead of unlinking them.")
if let Err(e) = bury(source, dest) {
println!("ERROR: {}: {}", e, target);
// Clean up any partial buries due to permission error
fs::remove_dir_all(dest).expect("Failed to clean up");
} else if let Err(e) = write_log(source, dest, record) {
println!("Error adding {} to record: {}", target, e);
}