@@ -267,7 +267,7 @@ def add_files(tar) # :nodoc:
267267
268268 tar . add_file_simple file , stat . mode , stat . size do |dst_io |
269269 File . open file , "rb" do |src_io |
270- copy_stream ( src_io , dst_io )
270+ copy_stream ( src_io , dst_io , stat . size )
271271 end
272272 end
273273 end
@@ -452,7 +452,7 @@ def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc:
452452
453453 if entry . file?
454454 File . open ( destination , "wb" ) do |out |
455- copy_stream ( entry , out )
455+ copy_stream ( entry , out , entry . size )
456456 # Flush needs to happen before chmod because there could be data
457457 # in the IO buffer that needs to be written, and that could be
458458 # written after the chmod (on close) which would mess up the perms
@@ -721,12 +721,12 @@ def verify_gz(entry) # :nodoc:
721721 end
722722
723723 if RUBY_ENGINE == "truffleruby"
724- def copy_stream ( src , dst ) # :nodoc:
725- dst . write src . read
724+ def copy_stream ( src , dst , size ) # :nodoc:
725+ dst . write src . read ( size )
726726 end
727727 else
728- def copy_stream ( src , dst ) # :nodoc:
729- IO . copy_stream ( src , dst )
728+ def copy_stream ( src , dst , size ) # :nodoc:
729+ IO . copy_stream ( src , dst , size )
730730 end
731731 end
732732
0 commit comments