Merge pull request #3662 from MikeMcQuaid/curl-executable

curl: handle more non-executable curl edge-cases.
This commit is contained in:
Mike McQuaid 2018-01-11 19:41:23 +00:00 committed by GitHub
commit 02591bdf34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)