From 808e495ec28d4bc3def13ade30cbb2a9f8b5cb87 Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Fri, 20 Jan 2023 06:54:46 +0100 Subject: [PATCH] restore: Don't abort on delete errors --- src/commands/restore.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/commands/restore.rs b/src/commands/restore.rs index d847519..93eeca0 100644 --- a/src/commands/restore.rs +++ b/src/commands/restore.rs @@ -189,16 +189,21 @@ fn allocate_and_collect( let path = entry.path(); match &removed_dir { Some(dir) if path.starts_with(dir) => {} - _ => { - dest.remove_dir(path) - .with_context(|| format!("error removing {path:?}"))?; - removed_dir = Some(path.to_path_buf()); - } + _ => match dest.remove_dir(path) { + Ok(()) => { + removed_dir = Some(path.to_path_buf()); + } + Err(err) => { + error!("error removing {path:?}: {err}"); + } + }, + } + } + (true, false, false) => { + if let Err(err) = dest.remove_file(entry.path()) { + error!("error removing {:?}: {err}", entry.path()); } } - (true, false, false) => dest - .remove_file(entry.path()) - .with_context(|| format!("error removing {:?}", entry.path()))?, (false, _, _) => { additional_existing = true; }