зеркало из https://github.com/github/ruby.git
fix tempfile leaks on Windows
* lib/rubygems/ext/ext_conf_builder.rb (build): needs to close before unlink on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0e7c81a713
Коммит
66b54b1a4a
|
@ -27,9 +27,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|||
# 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::Ext::Builder
|
|||
siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
|
||||
end
|
||||
|
||||
siteconf.flush
|
||||
siteconf.close
|
||||
|
||||
destdir = ENV["DESTDIR"]
|
||||
|
||||
|
@ -78,9 +76,9 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|||
end
|
||||
ensure
|
||||
ENV["DESTDIR"] = destdir
|
||||
siteconf.close!
|
||||
end
|
||||
end
|
||||
t.unlink if t and t.path
|
||||
|
||||
results
|
||||
ensure
|
||||
|
|
Загрузка…
Ссылка в новой задаче