summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/package.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 99be691ec7..0873040206 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -267,7 +267,7 @@ class Gem::Package
tar.add_file_simple file, stat.mode, stat.size do |dst_io|
File.open file, "rb" do |src_io|
- copy_stream(src_io, dst_io)
+ copy_stream(src_io, dst_io, stat.size)
end
end
end
@@ -452,7 +452,7 @@ EOM
if entry.file?
File.open(destination, "wb") do |out|
- copy_stream(entry, out)
+ copy_stream(entry, out, entry.size)
# Flush needs to happen before chmod because there could be data
# in the IO buffer that needs to be written, and that could be
# written after the chmod (on close) which would mess up the perms
@@ -721,12 +721,12 @@ EOM
end
if RUBY_ENGINE == "truffleruby"
- def copy_stream(src, dst) # :nodoc:
- dst.write src.read
+ def copy_stream(src, dst, size) # :nodoc:
+ dst.write src.read(size)
end
else
- def copy_stream(src, dst) # :nodoc:
- IO.copy_stream(src, dst)
+ def copy_stream(src, dst, size) # :nodoc:
+ IO.copy_stream(src, dst, size)
end
end