diff options
author | Andreas Tolfsen <ato@mozilla.com> | 2014-09-18 12:16:49 +0100 |
---|---|---|
committer | Andreas Tolfsen <ato@mozilla.com> | 2014-09-18 12:16:49 +0100 |
commit | a5b5d358fbeed00b43d3c83c4beb926b339f9727 (patch) | |
tree | d4c28b9aa42d753a6be58b7b35d3ec3ed20b1696 | |
parent | 340ebdfd85f9f9bb3caa352f5c679b4f3b3b9f97 (diff) | |
download | servo-a5b5d358fbeed00b43d3c83c4beb926b339f9727.tar.gz servo-a5b5d358fbeed00b43d3c83c4beb926b339f9727.zip |
Support dumb terminals in bootstrap downloads
Dumb terminals can only interpret a limited number of control codes,
and rewriting the terminal buffer will make `./mach build` very talkative
on these terminals.
This can be tested by setting the environment variable TERM to "dumb"
as such:
TERM=dumb ./mach build
-rw-r--r-- | python/servo/bootstrap_commands.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 13a411f7008..bf83803afac 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -47,8 +47,11 @@ def download(desc, src, dst): print("\rDownloading %s: %5.1f%%" % (desc, pct), end="") sys.stdout.flush() - urllib.urlretrieve(src, dst, report) - print() + print("Downloading %s..." % desc) + dumb = os.environ.get("TERM") == "dumb" + urllib.urlretrieve(src, dst, None if dumb else report) + if not dumb: + print() def extract(src, dst, movedir=None): tarfile.open(src).extractall(dst) |