bootstrap: pass long options to curl
This commit is contained in:
parent
44fac8934a
commit
757affd1a9
@ -106,9 +106,9 @@ def _download(path, url, probably_big, verbose, exception):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if (probably_big or verbose) and "GITHUB_ACTIONS" not in os.environ:
|
if (probably_big or verbose) and "GITHUB_ACTIONS" not in os.environ:
|
||||||
option = "-#"
|
option = "--progress-bar"
|
||||||
else:
|
else:
|
||||||
option = "-s"
|
option = "--silent"
|
||||||
# If curl is not present on Win32, we should not sys.exit
|
# If curl is not present on Win32, we should not sys.exit
|
||||||
# but raise `CalledProcessError` or `OSError` instead
|
# but raise `CalledProcessError` or `OSError` instead
|
||||||
require(["curl", "--version"], exception=platform_is_win32())
|
require(["curl", "--version"], exception=platform_is_win32())
|
||||||
@ -120,12 +120,15 @@ def _download(path, url, probably_big, verbose, exception):
|
|||||||
# for consistency.
|
# for consistency.
|
||||||
# they are also more compreprensivly explained in that file.
|
# they are also more compreprensivly explained in that file.
|
||||||
run(["curl", option] + extra_flags + [
|
run(["curl", option] + extra_flags + [
|
||||||
"-L", # Follow redirect.
|
# Follow redirect.
|
||||||
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
|
"--location",
|
||||||
"--connect-timeout", "30", # timeout if cannot connect within 30 seconds
|
# timeout if speed is < 10 bytes/sec for > 30 seconds
|
||||||
"-o", path,
|
"--speed-time", "30", "--speed-limit", "10",
|
||||||
|
# timeout if cannot connect within 30 seconds
|
||||||
|
"--connect-timeout", "30",
|
||||||
|
"--output", path,
|
||||||
"--continue-at", "-",
|
"--continue-at", "-",
|
||||||
"--retry", "3", "-SRf", url],
|
"--retry", "3", "--show-error", "--remote-time", "--fail", url],
|
||||||
verbose=verbose,
|
verbose=verbose,
|
||||||
exception=True, # Will raise RuntimeError on failure
|
exception=True, # Will raise RuntimeError on failure
|
||||||
)
|
)
|
||||||
|
@ -233,17 +233,17 @@ impl Config {
|
|||||||
let mut curl = command("curl");
|
let mut curl = command("curl");
|
||||||
curl.args([
|
curl.args([
|
||||||
// follow redirect
|
// follow redirect
|
||||||
"-L",
|
"--location",
|
||||||
// timeout if speed is < 10 bytes/sec for > 30 seconds
|
// timeout if speed is < 10 bytes/sec for > 30 seconds
|
||||||
"-y",
|
"--speed-time",
|
||||||
"30",
|
"30",
|
||||||
"-Y",
|
"--speed-limit",
|
||||||
"10",
|
"10",
|
||||||
// timeout if cannot connect within 30 seconds
|
// timeout if cannot connect within 30 seconds
|
||||||
"--connect-timeout",
|
"--connect-timeout",
|
||||||
"30",
|
"30",
|
||||||
// output file
|
// output file
|
||||||
"-o",
|
"--output",
|
||||||
tempfile.to_str().unwrap(),
|
tempfile.to_str().unwrap(),
|
||||||
// if there is an error, don't restart the download,
|
// if there is an error, don't restart the download,
|
||||||
// instead continue where it left off.
|
// instead continue where it left off.
|
||||||
@ -253,14 +253,16 @@ impl Config {
|
|||||||
// attempts will be made, since the first attempt isn't a *re*try.
|
// attempts will be made, since the first attempt isn't a *re*try.
|
||||||
"--retry",
|
"--retry",
|
||||||
"3",
|
"3",
|
||||||
// -S: show errors, even if -s is specified
|
// show errors, even if --silent is specified
|
||||||
// -R: set timestamp of downloaded file to that of the server
|
"--show-error",
|
||||||
// -f: fail on non-ok http status
|
// set timestamp of downloaded file to that of the server
|
||||||
"-SRf",
|
"--remote-time",
|
||||||
|
// fail on non-ok http status
|
||||||
|
"--fail",
|
||||||
]);
|
]);
|
||||||
// Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.
|
// Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.
|
||||||
if CiEnv::is_ci() {
|
if CiEnv::is_ci() {
|
||||||
curl.arg("-s");
|
curl.arg("--silent");
|
||||||
} else {
|
} else {
|
||||||
curl.arg("--progress-bar");
|
curl.arg("--progress-bar");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user