aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew')
-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