x.py fails all downloads that use a tempdir with snap curl #107722
This commit is contained in:
parent
5dd0e1b7ae
commit
4259073e9a
1 changed files with 10 additions and 8 deletions
|
@ -87,14 +87,16 @@ def _download(path, url, probably_big, verbose, exception):
|
||||||
# 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)
|
||||||
run(["curl", option,
|
with open(path, "wb") as outfile:
|
||||||
"-L", # Follow redirect.
|
run(["curl", option,
|
||||||
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
|
"-L", # Follow redirect.
|
||||||
"--connect-timeout", "30", # timeout if cannot connect within 30 seconds
|
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
|
||||||
"--retry", "3", "-Sf", "-o", path, url],
|
"--connect-timeout", "30", # timeout if cannot connect within 30 seconds
|
||||||
verbose=verbose,
|
"--retry", "3", "-Sf", url],
|
||||||
exception=True, # Will raise RuntimeError on failure
|
stdout=outfile, #Implements cli redirect operator '>'
|
||||||
)
|
verbose=verbose,
|
||||||
|
exception=True, # Will raise RuntimeError on failure
|
||||||
|
)
|
||||||
except (subprocess.CalledProcessError, OSError, RuntimeError):
|
except (subprocess.CalledProcessError, OSError, RuntimeError):
|
||||||
# see http://serverfault.com/questions/301128/how-to-download
|
# see http://serverfault.com/questions/301128/how-to-download
|
||||||
if platform_is_win32:
|
if platform_is_win32:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue