diff --git a/src/archive/tar.rs b/src/archive/tar.rs index b7755c3..57c3737 100644 --- a/src/archive/tar.rs +++ b/src/archive/tar.rs @@ -54,7 +54,7 @@ pub fn unpack_archive(reader: Box, output_folder: &Path, quiet: bool) /// List contents of `archive`, returning a vector of archive entries pub fn list_archive( mut archive: tar::Archive, -) -> impl Iterator> { +) -> crate::Result>> { struct Files(Receiver>); impl Iterator for Files { type Item = crate::Result; @@ -77,7 +77,7 @@ pub fn list_archive( } }); - Files(rx) + Ok(Files(rx)) } /// Compresses the archives given by `input_filenames` into the file given previously to `writer`. diff --git a/src/archive/zip.rs b/src/archive/zip.rs index 2df9925..823d172 100644 --- a/src/archive/zip.rs +++ b/src/archive/zip.rs @@ -106,7 +106,7 @@ where pub fn list_archive( mut archive: ZipArchive, password: Option<&[u8]>, -) -> impl Iterator> +) -> crate::Result>> where R: Read + Seek + Send + 'static, { @@ -146,7 +146,7 @@ where } }); - Files(rx) + Ok(Files(rx)) } /// Compresses the archives given by `input_filenames` into the file given previously to `writer`. diff --git a/src/commands/list.rs b/src/commands/list.rs index a2cdfc9..fc8aa75 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -34,7 +34,7 @@ pub fn list_archive_contents( // Any other Zip decompression done can take up the whole RAM and freeze ouch. if let &[Zip] = formats.as_slice() { let zip_archive = zip::ZipArchive::new(reader)?; - let files = crate::archive::zip::list_archive(zip_archive, password); + let files = crate::archive::zip::list_archive(zip_archive, password)?; list::list_files(archive_path, files, list_options)?; return Ok(()); @@ -64,7 +64,7 @@ pub fn list_archive_contents( } let files: Box>> = match formats[0] { - Tar => Box::new(crate::archive::tar::list_archive(tar::Archive::new(reader))), + Tar => Box::new(crate::archive::tar::list_archive(tar::Archive::new(reader))?), Zip => { if formats.len() > 1 { // Locking necessary to guarantee that warning and question @@ -81,7 +81,7 @@ pub fn list_archive_contents( io::copy(&mut reader, &mut vec)?; let zip_archive = zip::ZipArchive::new(io::Cursor::new(vec))?; - Box::new(crate::archive::zip::list_archive(zip_archive, password)) + Box::new(crate::archive::zip::list_archive(zip_archive, password)?) } #[cfg(feature = "unrar")] Rar => {