From e722f0e4d34ab003d2be4b329b4269d86d0942a3 Mon Sep 17 00:00:00 2001 From: David Anthoff Date: Fri, 17 Feb 2017 15:28:18 -0800 Subject: [PATCH] Close file after unzip operation --- src/zip_file.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/zip_file.jl b/src/zip_file.jl index a1e7f20..330582e 100644 --- a/src/zip_file.jl +++ b/src/zip_file.jl @@ -169,9 +169,11 @@ end # Based on fhs/ZipFile.jl#16, thanks @timholy. function unzip(archive, outputpath::AbstractString=pwd()) - for (filename, data) in open_zip(archive) - filename = joinpath(outputpath, filename) - mkpath_write(filename, data) + open_zip(archive) do file + for (filename, data) in file + filename = joinpath(outputpath, filename) + mkpath_write(filename, data) + end end end