aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2018-01-11 16:33:20 +0000
committerMike McQuaid2018-01-11 16:33:20 +0000
commit924865ec7f18078650be87ca31b6c0a434b0a78d (patch)
tree24f4556e4a2ed5a08267ba4403893fb753f7e078 /Library
parentb66010605dfb8ecd7e5eb9eb5d1b97462c259e4d (diff)
downloadbrew-924865ec7f18078650be87ca31b6c0a434b0a78d.tar.bz2
curl: handle more non-executable curl edge-cases.
Address some additional issues mentioned in #3624.
Diffstat (limited to 'Library')
-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)