aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2016-07-15 20:55:34 +0800
committerGitHub2016-07-15 20:55:34 +0800
commitde366f71b9c9fded0b5578bb4fef14139834038a (patch)
treee9128b740c162b9ce52694b82e75b19257baf4a8 /Library
parent2b078be186dec5d56ef11e1fcca4927506756704 (diff)
downloadbrew-de366f71b9c9fded0b5578bb4fef14139834038a.tar.bz2
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'.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 25797c8d9..4cb584525 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