aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominyk Tiller2015-06-05 22:35:08 +0100
committerMike McQuaid2015-07-18 20:48:00 -0700
commitac523bac06c97775420f7e5cb4c1922ce794ac14 (patch)
treeb61b98e6af1c4ff5b12bc83e78820343b76665db
parentb9cdfe21fc7c1dbfa2f6ce7a087a47556dfff5df (diff)
downloadbrew-ac523bac06c97775420f7e5cb4c1922ce794ac14.tar.bz2
formula: always override user home
Closes Homebrew/homebrew#40444. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
-rw-r--r--Library/Homebrew/formula.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index fc378b819..48ac4781f 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -946,8 +946,17 @@ class Formula
def stage
active_spec.stage do
@buildpath = Pathname.pwd
- yield
- @buildpath = nil
+ env_home = buildpath/".brew_home"
+ mkdir_p env_home
+
+ old_home, ENV["HOME"] = ENV["HOME"], env_home
+
+ begin
+ yield
+ ensure
+ @buildpath = nil
+ ENV["HOME"] = old_home
+ end
end
end