Pass verbosity options to curl
in download strategies.
This commit is contained in:
parent
16acd08d0a
commit
172bf76d74
@ -120,12 +120,18 @@ class AbstractDownloadStrategy
|
|||||||
def command!(*args, **options)
|
def command!(*args, **options)
|
||||||
system_command!(
|
system_command!(
|
||||||
*args,
|
*args,
|
||||||
|
env: env.merge(options.fetch(:env, {})),
|
||||||
|
**command_output_options,
|
||||||
|
**options,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def command_output_options
|
||||||
|
{
|
||||||
print_stdout: !quiet?,
|
print_stdout: !quiet?,
|
||||||
print_stderr: !quiet?,
|
print_stderr: !quiet?,
|
||||||
verbose: verbose? && !quiet?,
|
verbose: verbose? && !quiet?,
|
||||||
env: env,
|
}
|
||||||
**options,
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def env
|
def env
|
||||||
@ -484,7 +490,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
|
|
||||||
def curl(*args, **options)
|
def curl(*args, **options)
|
||||||
args << "--connect-timeout" << "15" unless mirrors.empty?
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,18 +44,19 @@ def curl_args(*extra_args, show_output: false, user_agent: :default)
|
|||||||
args + extra_args
|
args + extra_args
|
||||||
end
|
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 = {
|
command_options = {
|
||||||
secrets: secrets,
|
secrets: secrets,
|
||||||
print_stdout: print_stdout,
|
print_stdout: print_stdout,
|
||||||
print_stderr: print_stderr,
|
print_stderr: print_stderr,
|
||||||
|
verbose: verbose,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
# SSL_CERT_FILE can be incorrectly set by users or portable-ruby and screw
|
# SSL_CERT_FILE can be incorrectly set by users or portable-ruby and screw
|
||||||
# with SSL downloads so unset it here.
|
# with SSL downloads so unset it here.
|
||||||
result = system_command curl_executable,
|
result = system_command curl_executable,
|
||||||
args: curl_args(*args, **options),
|
args: curl_args(*args, **options),
|
||||||
env: env.merge({ "SSL_CERT_FILE" => nil }),
|
env: { "SSL_CERT_FILE" => nil }.merge(env),
|
||||||
**command_options
|
**command_options
|
||||||
|
|
||||||
if !result.success? && !args.include?("--http1.1")
|
if !result.success? && !args.include?("--http1.1")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user