Skip to content

Commit 4e31480

Browse files
committed
Merge pull request #9452 from ruby/surpress-tar-warning
Suppressed `zlib` warnings (cherry picked from commit 75c96af)
1 parent 23066ba commit 4e31480

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/rubygems/package.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,15 @@ def open_tar_gz(io) # :nodoc:
552552
tar = Gem::Package::TarReader.new gzio
553553

554554
yield tar
555+
ensure
556+
# Consume remaining gzip data to prevent the
557+
# "attempt to close unfinished zstream; reset forced" warning
558+
# when the GzipReader is closed with unconsumed compressed data.
559+
begin
560+
IO.copy_stream(gzio, IO::NULL)
561+
rescue Zlib::GzipFile::Error, IOError
562+
nil
563+
end
555564
end
556565
end
557566

0 commit comments

Comments
 (0)