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

ruby-changes:49350

From: nobu <ko1@a...>
Date: Mon, 25 Dec 2017 14:54:32 +0900 (JST)
Subject: [ruby-changes:49350] nobu:r61465 (trunk): fix leaked fds

nobu	2017-12-25 14:54:27 +0900 (Mon, 25 Dec 2017)

  New Revision: 61465

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

  Log:
    fix leaked fds
    
    * lib/rubygems/command.rb (Gem::Command#invoke_with_build_args):
      restore UI and close the created SilentUI.

  Modified files:
    trunk/lib/rubygems/command.rb
Index: lib/rubygems/command.rb
===================================================================
--- lib/rubygems/command.rb	(revision 61464)
+++ lib/rubygems/command.rb	(revision 61465)
@@ -300,7 +300,10 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L300
 
     options[:build_args] = build_args
 
-    self.ui = Gem::SilentUI.new if options[:silent]
+    if options[:silent]
+      old_ui = self.ui
+      self.ui = ui = Gem::SilentUI.new
+    end
 
     if options[:help] then
       show_help
@@ -309,6 +312,11 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L312
     else
       execute
     end
+  ensure
+    if ui
+      self.ui = old_ui
+      ui.close
+    end
   end
 
   ##

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

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