fix: Make incremental artifact deletion more robust

Should fix the intermittent errors reported in #57958

cc #48614
This commit is contained in:
Markus Westerlind 2019-03-26 23:45:40 +01:00
parent fbd34efb32
commit a365287e10

View File

@ -886,7 +886,10 @@ fn safe_remove_dir_all(p: &Path) -> io::Result<()> {
fn safe_remove_file(p: &Path) -> io::Result<()> {
if p.exists() {
let canonicalized = p.canonicalize()?;
std_fs::remove_file(canonicalized)
match std_fs::remove_file(canonicalized) {
Err(ref err) if err.kind() == io::ErrorKind::NotFound => Ok(()),
result => result,
}
} else {
Ok(())
}