Skip to content

Commit

Permalink
use close instead of TranscodingStreams.finalize (#41)
Browse files Browse the repository at this point in the history
* use close instead of finalize

* remove nightly CI
  • Loading branch information
nhz2 authored Mar 18, 2024
1 parent 7245e44 commit a7f8230
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
version:
- '1.6'
- '1'
- 'nightly'
# - 'nightly'
os:
- ubuntu-latest
- macOS-13 # intel
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a"
ArgCheck = "2"
CodecZlib = "0.7"
PrecompileTools = "1"
TranscodingStreams = "0.9, 0.10"
TranscodingStreams = "0.10.5"
Zlib_jll = "1"
julia = "1.6.0"
6 changes: 3 additions & 3 deletions src/writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function zip_newfile(w::ZipWriter, name::AbstractString;
throw(ArgumentError("compression_method must be Deflate or Store"))
end
pe.bit_flags |= level_bits
w.transcoder = TranscodingStream(codec, io; sharedbuf=false)
w.transcoder = TranscodingStream(codec, io; sharedbuf=false, stop_on_end=true)
pe.method = real_compression_method

write_local_header(io, pe)
Expand Down Expand Up @@ -309,7 +309,7 @@ function zip_commitfile(w::ZipWriter)
write(transcoder, TranscodingStreams.TOKEN_END)
finally
# Prevent memory leak maybe.
TranscodingStreams.finalize(transcoder.codec)
close(transcoder)
end
cur_offset = position(w._io)
pe.compressed_size = cur_offset - pe.offset - pe.local_header_size
Expand Down Expand Up @@ -357,7 +357,7 @@ function zip_abortfile(w::ZipWriter)
write(transcoder, TranscodingStreams.TOKEN_END)
finally
# Prevent memory leak maybe.
TranscodingStreams.finalize(transcoder.codec)
close(transcoder)
end
end
nothing
Expand Down

0 comments on commit a7f8230

Please sign in to comment.