aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2018-01-11 19:41:23 +0000
committerGitHub2018-01-11 19:41:23 +0000
commit02591bdf341b4c33383b5eb537bcff0e49157a82 (patch)
treecb9f0c1b201bb3cc6e235611675cec5e7499ca91
parent77518d7e9b7b0c277aef49a8c157a46b6af58819 (diff)
parent924865ec7f18078650be87ca31b6c0a434b0a78d (diff)
downloadbrew-02591bdf341b4c33383b5eb537bcff0e49157a82.tar.bz2
Merge pull request #3662 from MikeMcQuaid/curl-executable
curl: handle more non-executable curl edge-cases.
-rw-r--r--Library/Homebrew/utils/curl.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb
index cf1735576..65edd85df 100644
--- a/Library/Homebrew/utils/curl.rb
+++ b/Library/Homebrew/utils/curl.rb
@@ -2,10 +2,13 @@ require "pathname"
require "open3"
def curl_executable
- curl = Pathname.new ENV["HOMEBREW_CURL"]
- curl = which("curl") unless curl.exist?
- return curl if curl.executable?
- raise "#{curl} is not executable"
+ @curl ||= [
+ ENV["HOMEBREW_CURL"],
+ which("curl"),
+ "/usr/bin/curl",
+ ].map { |c| Pathname(c) }.find(&:executable?)
+ raise "curl is not executable" unless @curl
+ @curl
end
def curl_args(*extra_args, show_output: false, user_agent: :default)