build: use with_env helper

This commit is contained in:
Misty De Meo 2017-07-15 17:26:42 -07:00
parent 610af15f0e
commit 8e645dfbec
No known key found for this signature in database
GPG Key ID: 76CF846A2F674B2C

View File

@ -102,11 +102,13 @@ class Build
end end
end end
old_tmpdir = ENV["TMPDIR"] new_env = {
old_temp = ENV["TEMP"] "TMPDIR" => HOMEBREW_TEMP,
old_tmp = ENV["TMP"] "TEMP" => HOMEBREW_TEMP,
ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP "TMP" => HOMEBREW_TEMP,
}
with_env(new_env) do
formula.extend(Debrew::Formula) if ARGV.debug? formula.extend(Debrew::Formula) if ARGV.debug?
formula.brew do |_formula, staging| formula.brew do |_formula, staging|
@ -145,10 +147,7 @@ class Build
formula.prefix.install_metafiles formula.libexec if formula.libexec.exist? formula.prefix.install_metafiles formula.libexec if formula.libexec.exist?
end end
end end
ensure end
ENV["TMPDIR"] = old_tmpdir
ENV["TEMP"] = old_temp
ENV["TMP"] = old_tmp
end end
def detect_stdlibs(compiler) def detect_stdlibs(compiler)