summaryrefslogtreecommitdiff
path: root/lib/rubygems/package/io_source.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/package/io_source.rb')
-rw-r--r--lib/rubygems/package/io_source.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/rubygems/package/io_source.rb b/lib/rubygems/package/io_source.rb
index 7d7383110b..227835dfce 100644
--- a/lib/rubygems/package/io_source.rb
+++ b/lib/rubygems/package/io_source.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
##
# Supports reading and writing gems from/to a generic IO object. This is
# useful for other applications built on top of rubygems, such as
@@ -32,10 +33,14 @@ class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all
def with_read_io
yield io
+ ensure
+ io.rewind
end
def with_write_io
yield io
+ ensure
+ io.rewind
end
def path