utils/curl: make --show-error optional

This commit is contained in:
Xuehai Pan 2023-02-04 12:04:37 +00:00
parent 17b08f2f01
commit 4322e57dd0
2 changed files with 6 additions and 2 deletions

View File

@ -51,7 +51,9 @@ module Homebrew
begin
begin
# Disable retries here, we handle them ourselves below.
Utils::Curl.curl_download(*curl_args, to: target, max_time: JSON_API_MAX_TIME, retries: 0)
Utils::Curl.curl_download(*curl_args, url, to: target,
max_time: JSON_API_MAX_TIME, retries: 0,
show_error: false)
rescue ErrorDuringExecution
if url == default_url
raise unless target.exist?

View File

@ -54,6 +54,7 @@ module Utils
retries: T.nilable(Integer),
retry_max_time: T.any(Integer, Float, NilClass),
show_output: T.nilable(T::Boolean),
show_error: T.nilable(T::Boolean),
user_agent: T.any(String, Symbol, NilClass),
).returns(T::Array[T.untyped])
}
@ -64,6 +65,7 @@ module Utils
retries: Homebrew::EnvConfig.curl_retries.to_i,
retry_max_time: nil,
show_output: false,
show_error: true,
user_agent: nil
)
args = []
@ -76,7 +78,7 @@ module Utils
args << "--globoff"
args << "--show-error"
args << "--show-error" if show_error
args << "--user-agent" << case user_agent
when :browser, :fake