diff options
Diffstat (limited to 'Library/Homebrew/utils')
| -rw-r--r-- | Library/Homebrew/utils/curl.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/utils/github.rb | 2 |
2 files changed, 8 insertions, 5 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) diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index be9bf4dd3..016676323 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -129,7 +129,7 @@ module GitHub # This is a no-op if the user is opting out of using the GitHub API. return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"] - args = %W[--header application/vnd.github.v3+json --write-out \n%{http_code}] + args = %W[--header application/vnd.github.v3+json --write-out \n%{http_code}] # rubocop:disable Lint/NestedPercentLiteral args += curl_args token, username = api_credentials |
