ruby-changes:46626
From: nobu <ko1@a...>
Date: Tue, 16 May 2017 14:48:00 +0900 (JST)
Subject: [ruby-changes:46626] nobu:r58741 (trunk): fix tempfile leaks on Windows
nobu 2017-05-16 14:47:53 +0900 (Tue, 16 May 2017) New Revision: 58741 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58741 Log: fix tempfile leaks on Windows * lib/rubygems/ext/ext_conf_builder.rb (build): needs to close before unlink on Windows. Modified files: trunk/lib/rubygems/ext/ext_conf_builder.rb Index: lib/rubygems/ext/ext_conf_builder.rb =================================================================== --- lib/rubygems/ext/ext_conf_builder.rb (revision 58740) +++ lib/rubygems/ext/ext_conf_builder.rb (revision 58741) @@ -27,9 +27,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L27 # TODO: Make this unconditional when rubygems no longer supports Ruby 1.9.x. tmp_dest = get_relative_path(tmp_dest) unless Gem.win_platform? && RUBY_VERSION <= '2.0' - t = nil Tempfile.open %w"siteconf .rb", "." do |siteconf| - t = siteconf siteconf.puts "require 'rbconfig'" siteconf.puts "dest_path = #{tmp_dest.dump}" %w[sitearchdir sitelibdir].each do |dir| @@ -37,7 +35,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L35 siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path" end - siteconf.flush + siteconf.close destdir = ENV["DESTDIR"] @@ -78,9 +76,9 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L76 end ensure ENV["DESTDIR"] = destdir + siteconf.close! end end - t.unlink if t and t.path results ensure -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/