Suppress download status meter when routing I/O to a file.
This commit is contained in:
parent
44003449d5
commit
14097e39cc
@ -41,6 +41,7 @@
|
|||||||
Archive a source directory, e.g. for creating a mirror.
|
Archive a source directory, e.g. for creating a mirror.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
@ -141,13 +142,19 @@ def fetch(self):
|
|||||||
|
|
||||||
tty.msg("Trying to fetch from %s" % self.url)
|
tty.msg("Trying to fetch from %s" % self.url)
|
||||||
|
|
||||||
|
curl_args = ['-O', # save file to disk
|
||||||
|
'-f', # fail on >400 errors
|
||||||
|
'-D', '-', # print out HTML headers
|
||||||
|
'-L', self.url,]
|
||||||
|
|
||||||
|
if sys.stdout.isatty():
|
||||||
|
curl_args.append('-#') # status bar when using a tty
|
||||||
|
else:
|
||||||
|
curl_args.append('-sS') # just errors when not.
|
||||||
|
|
||||||
# Run curl but grab the mime type from the http headers
|
# Run curl but grab the mime type from the http headers
|
||||||
headers = spack.curl('-#', # status bar
|
headers = spack.curl(
|
||||||
'-O', # save file to disk
|
*curl_args, return_output=True, fail_on_error=False)
|
||||||
'-f', # fail on >400 errors
|
|
||||||
'-D', '-', # print out HTML headers
|
|
||||||
'-L', self.url,
|
|
||||||
return_output=True, fail_on_error=False)
|
|
||||||
|
|
||||||
if spack.curl.returncode != 0:
|
if spack.curl.returncode != 0:
|
||||||
# clean up archive on failure.
|
# clean up archive on failure.
|
||||||
|
Loading…
Reference in New Issue
Block a user