[前][次][番号順一覧][スレッド一覧]

ruby-changes:34859

From: nobu <ko1@a...>
Date: Fri, 25 Jul 2014 15:53:46 +0900 (JST)
Subject: [ruby-changes:34859] nobu:r46942 (trunk): test_gem_silent_ui.rb: fix leaked FDs

nobu	2014-07-25 15:53:31 +0900 (Fri, 25 Jul 2014)

  New Revision: 46942

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46942

  Log:
    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.

  Modified files:
    trunk/lib/rubygems/user_interaction.rb
    trunk/test/rubygems/test_gem_silent_ui.rb
Index: lib/rubygems/user_interaction.rb
===================================================================
--- lib/rubygems/user_interaction.rb	(revision 46941)
+++ lib/rubygems/user_interaction.rb	(revision 46942)
@@ -378,9 +378,13 @@ class Gem::StreamUI https://github.com/ruby/ruby/blob/trunk/lib/rubygems/user_interaction.rb#L378
   # 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 https://github.com/ruby/ruby/blob/trunk/lib/rubygems/user_interaction.rb#L687
     super reader, writer, writer, false
   end
 
+  def close
+    super
+    @ins.close
+    @outs.close
+  end
+
   def download_reporter(*args) # :nodoc:
     SilentDownloadReporter.new(@outs, *args)
   end
Index: test/rubygems/test_gem_silent_ui.rb
===================================================================
--- test/rubygems/test_gem_silent_ui.rb	(revision 46941)
+++ test/rubygems/test_gem_silent_ui.rb	(revision 46942)
@@ -9,6 +9,11 @@ class TestGemSilentUI < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_silent_ui.rb#L9
     @sui = Gem::SilentUI.new
   end
 
+  def teardown
+    @sui.close
+    super
+  end
+
   def test_ask
     value = nil
     out, err = capture_io do

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]