diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 811a33a0bc..c6f18f7038 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -120,12 +120,18 @@ class AbstractDownloadStrategy def command!(*args, **options) system_command!( *args, + env: env.merge(options.fetch(:env, {})), + **command_output_options, + **options, + ) + end + + def command_output_options + { print_stdout: !quiet?, print_stderr: !quiet?, verbose: verbose? && !quiet?, - env: env, - **options, - ) + } end def env @@ -484,7 +490,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy def curl(*args, **options) args << "--connect-timeout" << "15" unless mirrors.empty? - super(*_curl_args, *args, **_curl_opts, **options) + super(*_curl_args, *args, **_curl_opts, **command_output_options, **options) end end diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index d1f37dcede..4b0992b89b 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -44,18 +44,19 @@ def curl_args(*extra_args, show_output: false, user_agent: :default) args + extra_args end -def curl_with_workarounds(*args, secrets: nil, print_stdout: nil, print_stderr: nil, env: {}, **options) +def curl_with_workarounds(*args, secrets: nil, print_stdout: nil, print_stderr: nil, verbose: nil, env: {}, **options) command_options = { secrets: secrets, print_stdout: print_stdout, print_stderr: print_stderr, + verbose: verbose, }.compact # SSL_CERT_FILE can be incorrectly set by users or portable-ruby and screw # with SSL downloads so unset it here. result = system_command curl_executable, args: curl_args(*args, **options), - env: env.merge({ "SSL_CERT_FILE" => nil }), + env: { "SSL_CERT_FILE" => nil }.merge(env), **command_options if !result.success? && !args.include?("--http1.1")