Cope with stray files in the rsync collector’s directory.

This commit is contained in:
Martin Hoffmann
2022-01-13 11:10:10 +01:00
parent bb5fbe091f
commit 4d1a8a9577
2 changed files with 15 additions and 2 deletions
+2 -2
View File
@@ -364,7 +364,7 @@ impl<'a> Run<'a> {
};
if !keep {
fatal::remove_dir_all(entry.path())?;
fatal::remove_all(entry.path())?;
}
}
@@ -395,7 +395,7 @@ impl<'a> Run<'a> {
};
if !keep {
fatal::remove_dir_all(entry.path())?;
fatal::remove_all(entry.path())?;
}
else {
keep_host = true;
+13
View File
@@ -214,6 +214,19 @@ pub fn remove_file(path: &Path) -> Result<(), Failed> {
}
//------------ remove_all ----------------------------------------------------
/// Removes a file or a directory tree.
pub fn remove_all(path: &Path) -> Result<(), Failed> {
if path.is_dir() {
remove_dir_all(path)
}
else {
remove_file(path)
}
}
//------------ rename --------------------------------------------------------
/// Renames a file or directory.