Skip to content

Commit

Permalink
error logging in tar extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
harshdoesdev committed Sep 29, 2023
1 parent ed181c4 commit 7a1999b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ pub fn extract_tar_gz(
buffer: &[u8],
dest_path: &std::path::Path,
) -> vercel_cache_helper::Result<()> {
println!("Preparing to extract archive...");
println!("Preparing to extract archive in {}...", dest_path.to_string_lossy());
let tar = flate2::read::GzDecoder::new(buffer);
let mut archive = tar::Archive::new(tar);
archive.unpack(dest_path)?;
if let Err(err) = archive.unpack(dest_path) {
println!("Error extracting archive: {}", err);
return Err(err.into());
}
println!("Unpacked archive in: {}", &dest_path.to_string_lossy());
Ok(())
}

0 comments on commit 7a1999b

Please sign in to comment.