summaryrefslogtreecommitdiff
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-06-06 15:25:18 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-06-06 15:25:18 +0900
commit861b50d81d9ed5f57b78c87b2e2f24f718db31dd (patch)
tree9d74bbf4d43c7b3e29066ae53a60aa86c0c6c0bb /lib/rubygems.rb
parent1e54903684aa3c9ea3fe54520157846a1b1f07be (diff)
lib/rubygems.rb: Stop "Leaked file descriptor" warning
Bundler.setup changes Gem::DefaultUserInteraction.ui and does not close it. This change makes sure that it is closed.
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index c013e4b..3508a1f 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1208,7 +1208,13 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
require 'rubygems/user_interaction'
Gem::DefaultUserInteraction.use_ui(ui) do
require "bundler"
- @gemdeps = Bundler.setup
+ begin
+ @gemdeps = Bundler.setup
+ ensure
+ if Gem::DefaultUserInteraction.ui.is_a?(Gem::SilentUI)
+ Gem::DefaultUserInteraction.ui.close
+ end
+ end
Bundler.ui = nil
@gemdeps.requested_specs.map(&:to_spec).sort_by(&:name)
end