Skip to content

Commit 827055d

Browse files
committed
bootstrap: make wget use similar options to curl
1 parent c572543 commit 827055d

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/bootstrap/bootstrap.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,19 @@ def _download(path, url, probably_big, verbose, exception):
102102

103103
try:
104104
if has_wget():
105-
run(["wget", "--show-progress", "-O", path, url],
105+
# options should be kept in sync with
106+
# src/bootstrap/src/core/download.rs
107+
# for consistancy
108+
# these flags should also be as close as possible to the behavior
109+
# of curl (except for wget's superior handling of surious network
110+
# errors)
111+
# curl's -R and -f are wget's default behavior.
112+
run(["wget",
113+
"--connect-timeout=30",
114+
"--read-timeout=30",
115+
"--tries=3",
116+
"--show-progress",
117+
"-O", path, url],
106118
verbose=verbose,
107119
exception=True,
108120
)
@@ -121,6 +133,9 @@ def _download(path, url, probably_big, verbose, exception):
121133
# timeout if cannot connect within 30 seconds
122134
"--connect-timeout", "30",
123135
"-o", path,
136+
# -S: show errors, even if -s is specified
137+
# -R: set timestamp of downloaded file to that of the server
138+
# -f: fail on http error
124139
"--retry", "3", "-SRf", url],
125140
verbose=verbose,
126141
exception=True, # Will raise RuntimeError on failure

src/bootstrap/src/core/download.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,15 @@ impl Config {
225225
"3",
226226
"-SRf",
227227
]);
228-
wget.args(["-O", tempfile.to_str().unwrap()]);
228+
// options should be kept in sync with
229+
// src/bootstrap/bootstrap.py
230+
// for consistancy
231+
wget.args([
232+
"--connect-timeout=30",
233+
"--read-timeout=30",
234+
"--tries=3",
235+
"-O", tempfile.to_str().unwrap()
236+
]);
229237
// Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.
230238
if CiEnv::is_ci() {
231239
curl.arg("-s");

0 commit comments

Comments
 (0)