From ac523bac06c97775420f7e5cb4c1922ce794ac14 Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Fri, 5 Jun 2015 22:35:08 +0100 Subject: [PATCH] formula: always override user home Closes Homebrew/homebrew#40444. Signed-off-by: Mike McQuaid --- Library/Homebrew/formula.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index fc378b819e..48ac4781f1 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