1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use Tempfile.create to unlink the tempfile on Windows

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2013-07-10 08:27:34 +00:00
parent 6d45dd20df
commit 7bc77b76fe

View file

@ -15,7 +15,9 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
def self.build(extension, directory, dest_path, results, args=[])
tmp_dest = Dir.mktmpdir(".gem.", ".")
t = nil
Tempfile.open %w"siteconf .rb", "." do |siteconf|
t = siteconf
siteconf.puts "require 'rbconfig'"
siteconf.puts "dest_path = #{(tmp_dest || dest_path).dump}"
%w[sitearchdir sitelibdir].each do |dir|
@ -54,6 +56,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
ENV["DESTDIR"] = destdir
end
end
t.unlink if t
ensure
FileUtils.rm_rf tmp_dest if tmp_dest
end