Add timeout to use of curl in bootstrap.py.

This commit is contained in:
kennytm 2018-07-30 12:06:22 +08:00
parent b12235db09
commit 2994b27e40
No known key found for this signature in database
GPG Key ID: FEF6C8051D0E013C

View File

@ -88,7 +88,10 @@ def _download(path, url, probably_big, verbose, exception):
option = "-#"
else:
option = "-s"
run(["curl", option, "--retry", "3", "-Sf", "-o", path, url],
run(["curl", option,
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
"--connect-timeout", "30", # timeout if cannot connect within 30 seconds
"--retry", "3", "-Sf", "-o", path, url],
verbose=verbose,
exception=exception)