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
Родитель 3b26b3898e
Коммит ebed2ef335
2 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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