From de366f71b9c9fded0b5578bb4fef14139834038a Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Fri, 15 Jul 2016 20:55:34 +0800 Subject: [PATCH] respect user's curlrc file (#516) Users may have ~/.curlrc file to include options like proxies. However, since we overwrite HOME environment variable during the build and test, curl won't be able to find it. This commit solves this issue by using CURL_HOME environment variable, which will be pointed to the original HOME path. From `curl(1)`: > 1) curl tries to find the "home dir": It first checks for the CURL_HOME and then the HOME environment variables. Failing that, it uses getpwuid() on Unix-like systems (which returns the home dir given the current user in your system). On Windows, it then checks for the APPDATA variable, or as a last resort the '%USER- PROFILE%\Application Data'. --- Library/Homebrew/formula.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 25797c8d97..4cb5845253 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1324,6 +1324,8 @@ class Formula # @private def run_test old_home = ENV["HOME"] + old_curl_home = ENV["CURL_HOME"] + ENV["CURL_HOME"] = old_curl_home || old_home build, self.build = self.build, Tab.for_formula(self) mktemp("#{name}-test") do |staging| staging.retain! if ARGV.keep_tmp? @@ -1341,6 +1343,7 @@ class Formula @testpath = nil self.build = build ENV["HOME"] = old_home + ENV["CURL_HOME"] = old_curl_home end # @private @@ -1555,6 +1558,8 @@ class Formula mkdir_p env_home old_home, ENV["HOME"] = ENV["HOME"], env_home + old_curl_home = ENV["CURL_HOME"] + ENV["CURL_HOME"] = old_curl_home || old_home setup_home env_home begin @@ -1562,6 +1567,7 @@ class Formula ensure @buildpath = nil ENV["HOME"] = old_home + ENV["CURL_HOME"] = old_curl_home end end end