mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-05 02:55:31 +00:00
fix(archive): handle file open error in list_archive method
This commit is contained in:
parent
08ab63837e
commit
bafbd83bd7
@ -182,7 +182,13 @@ pub fn list_archive(
|
||||
archive_path: &Path,
|
||||
password: Option<&[u8]>,
|
||||
) -> impl Iterator<Item = crate::Result<FileInArchive>> {
|
||||
let reader = fs::File::open(archive_path).unwrap();
|
||||
let reader = fs::File::open(archive_path);
|
||||
|
||||
if let Err(e) = reader {
|
||||
return vec![Err(Error::IoError {reason:e.to_string()})].into_iter();
|
||||
}
|
||||
|
||||
let reader = reader.unwrap();
|
||||
|
||||
let mut files = Vec::new();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user