diff options
| author | Misty De Meo | 2017-07-15 17:26:51 -0700 |
|---|---|---|
| committer | Misty De Meo | 2017-07-15 17:41:17 -0700 |
| commit | 32b7e32856e61f256f2703faa17cdbcee26e17b7 (patch) | |
| tree | 4b1c18da41e1923d6c824bace725f63fa41c75f2 /Library/Homebrew | |
| parent | 8e645dfbec77e03f65a9163da4437a160e69027c (diff) | |
| download | brew-32b7e32856e61f256f2703faa17cdbcee26e17b7.tar.bz2 | |
formula: use env helper
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/formula.rb | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index da375d8a7..b2e4ff988 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -955,30 +955,27 @@ class Formula build = self.build self.build = Tab.for_formula(self) - old_tmpdir = ENV["TMPDIR"] - old_temp = ENV["TEMP"] - old_tmp = ENV["TMP"] - old_path = ENV["HOMEBREW_PATH"] - - ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP - ENV["HOMEBREW_PATH"] = nil + new_env = { + "TMPDIR" => HOMEBREW_TEMP, + "TEMP" => HOMEBREW_TEMP, + "TMP" => HOMEBREW_TEMP, + "HOMEBREW_PATH" => nil, + } - ENV.clear_sensitive_environment! + with_env(new_env) do + ENV.clear_sensitive_environment! - Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path| - path.extend(InstallRenamed) - path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX) - end + Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path| + path.extend(InstallRenamed) + path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX) + end - with_logging("post_install") do - post_install + with_logging("post_install") do + post_install + end end ensure self.build = build - ENV["TMPDIR"] = old_tmpdir - ENV["TEMP"] = old_temp - ENV["TMP"] = old_tmp - ENV["HOMEBREW_PATH"] = old_path @prefix_returns_versioned_prefix = false end |
