1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_gem_silent_ui.rb: fix leaked FDs

* lib/rubygems/user_interaction.rb (Gem::StreamUI#close): clean up
  IOs.

* test/rubygems/test_gem_silent_ui.rb (TestGemSilentUI#teardown):
  fix leaked FDs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-07-25 06:53:31 +00:00
parent 3b26b3898e
commit ebed2ef335
2 changed files with 15 additions and 0 deletions

View file

@ -378,9 +378,13 @@ class Gem::StreamUI
# handlers that might have been defined.
def terminate_interaction(status = 0)
close
raise Gem::SystemExitException, status
end
def close
end
##
# Return a progress reporter object chosen from the current verbosity.
@ -683,6 +687,12 @@ class Gem::SilentUI < Gem::StreamUI
super reader, writer, writer, false
end
def close
super
@ins.close
@outs.close
end
def download_reporter(*args) # :nodoc:
SilentDownloadReporter.new(@outs, *args)
end

View file

@ -9,6 +9,11 @@ class TestGemSilentUI < Gem::TestCase
@sui = Gem::SilentUI.new
end
def teardown
@sui.close
super
end
def test_ask
value = nil
out, err = capture_io do