summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-16 05:47:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-16 05:47:53 +0000
commit66b54b1a4ae9f3d38c47e23ecec6a40c07a80c21 (patch)
tree0ca59e6cd3b1072adffc8c28cf16741222cf032a /lib
parent0e7c81a713892fa0d43496eb8a9cba17f5b4e21b (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index b6dde01950..965b728278 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -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