Permalink
Browse files

Use Tempfile.create to unlink siteconf on Windows

Import of r41893 from ruby trunk by naruse
  • Loading branch information...
1 parent 2ff987f commit f815636f1cd8d846cd71a5b767d193cafd8dcf6a @drbrain drbrain committed Jul 10, 2013
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/rubygems/ext/ext_conf_builder.rb
View
3 lib/rubygems/ext/ext_conf_builder.rb
@@ -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|
@@ -55,6 +57,7 @@ def self.build(extension, directory, dest_path, results, args=[])
ENV["DESTDIR"] = destdir
end
end
+ t.unlink if t
ensure
FileUtils.rm_rf tmp_dest if tmp_dest
end

0 comments on commit f815636

Please sign in to comment.