Skip to content

Commit 757affd

Browse files
committed
bootstrap: pass long options to curl
1 parent 44fac89 commit 757affd

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

Diff for: src/bootstrap/bootstrap.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def _download(path, url, probably_big, verbose, exception):
106106

107107
try:
108108
if (probably_big or verbose) and "GITHUB_ACTIONS" not in os.environ:
109-
option = "-#"
109+
option = "--progress-bar"
110110
else:
111-
option = "-s"
111+
option = "--silent"
112112
# If curl is not present on Win32, we should not sys.exit
113113
# but raise `CalledProcessError` or `OSError` instead
114114
require(["curl", "--version"], exception=platform_is_win32())
@@ -120,12 +120,15 @@ def _download(path, url, probably_big, verbose, exception):
120120
# for consistency.
121121
# they are also more compreprensivly explained in that file.
122122
run(["curl", option] + extra_flags + [
123-
"-L", # Follow redirect.
124-
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
125-
"--connect-timeout", "30", # timeout if cannot connect within 30 seconds
126-
"-o", path,
123+
# Follow redirect.
124+
"--location",
125+
# timeout if speed is < 10 bytes/sec for > 30 seconds
126+
"--speed-time", "30", "--speed-limit", "10",
127+
# timeout if cannot connect within 30 seconds
128+
"--connect-timeout", "30",
129+
"--output", path,
127130
"--continue-at", "-",
128-
"--retry", "3", "-SRf", url],
131+
"--retry", "3", "--show-error", "--remote-time", "--fail", url],
129132
verbose=verbose,
130133
exception=True, # Will raise RuntimeError on failure
131134
)

Diff for: src/bootstrap/src/core/download.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,17 @@ impl Config {
233233
let mut curl = command("curl");
234234
curl.args([
235235
// follow redirect
236-
"-L",
236+
"--location",
237237
// timeout if speed is < 10 bytes/sec for > 30 seconds
238-
"-y",
238+
"--speed-time",
239239
"30",
240-
"-Y",
240+
"--speed-limit",
241241
"10",
242242
// timeout if cannot connect within 30 seconds
243243
"--connect-timeout",
244244
"30",
245245
// output file
246-
"-o",
246+
"--output",
247247
tempfile.to_str().unwrap(),
248248
// if there is an error, don't restart the download,
249249
// instead continue where it left off.
@@ -253,14 +253,16 @@ impl Config {
253253
// attempts will be made, since the first attempt isn't a *re*try.
254254
"--retry",
255255
"3",
256-
// -S: show errors, even if -s is specified
257-
// -R: set timestamp of downloaded file to that of the server
258-
// -f: fail on non-ok http status
259-
"-SRf",
256+
// show errors, even if --silent is specified
257+
"--show-error",
258+
// set timestamp of downloaded file to that of the server
259+
"--remote-time",
260+
// fail on non-ok http status
261+
"--fail",
260262
]);
261263
// Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.
262264
if CiEnv::is_ci() {
263-
curl.arg("-s");
265+
curl.arg("--silent");
264266
} else {
265267
curl.arg("--progress-bar");
266268
}

0 commit comments

Comments
 (0)