mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
fix: make snapshot file read errors non-fatal
This commit is contained in:
parent
b107a83bb3
commit
abef69c852
@ -585,9 +585,8 @@ fn add_path_to_archive(
|
||||
|
||||
if let Ok(metadata) = std::fs::metadata(full_path) {
|
||||
debug!("adding {full_path:?} to snapshot");
|
||||
let data = std::fs::read(full_path)
|
||||
.with_context(|| format!("Could not read file at {full_path:?}"))?;
|
||||
|
||||
match std::fs::read(full_path) {
|
||||
Ok(data) => {
|
||||
let mut header = tar::Header::new_gnu();
|
||||
header.set_size(data.len().try_into().unwrap());
|
||||
header.set_mode(metadata.mode());
|
||||
@ -599,5 +598,10 @@ fn add_path_to_archive(
|
||||
.append_data(&mut header, archive_path, Cursor::new(data))
|
||||
.context("Could not write data to archive")?;
|
||||
}
|
||||
Err(err) => {
|
||||
warn!("file {full_path:?} exists, but could not be added to snapshot: {err}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user