diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-01-22 20:04:41 +0530 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2020-01-22 17:29:38 -0500 |
commit | 06dddf2ef0e43755cf23ec2d826f3692e42639be (patch) | |
tree | b472986d5fbf0ab88f0d44d07f58ae90fccb04b3 | |
parent | e962147d8a1a1551868d7f261f812430d2778304 (diff) | |
download | meson-06dddf2ef0e43755cf23ec2d826f3692e42639be.zip meson-06dddf2ef0e43755cf23ec2d826f3692e42639be.tar.gz meson-06dddf2ef0e43755cf23ec2d826f3692e42639be.tar.bz2 |
wrap: Re-set the console mode after calling git
`git submodule update --recursive` calls git clone recursively, and on
Windows it will undo the console mode we set in mlog and cause ANSI
colors to stop working. We could set it again only when we call that,
but we will definitely miss other instances where this could happen
in the future and regress.
-rw-r--r-- | mesonbuild/wrap/wrap.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 64bc88e..92e37de 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -18,6 +18,7 @@ import urllib.request import urllib.error import urllib.parse import os +import platform import hashlib import shutil import tempfile @@ -53,6 +54,11 @@ def git(cmd: T.List[str], workingdir: str, **kwargs) -> subprocess.CompletedProc # Redirect stdin to DEVNULL otherwise git messes up the # console and ANSI colors stop working on Windows. stdin=subprocess.DEVNULL, **kwargs) + # Sometimes git calls git recursively, such as `git submodule update + # --recursive` which will be without the above workaround, so set the + # console mode again just in case. + if platform.system().lower() == 'windows': + mlog._windows_ansi() return pc def quiet_git(cmd: T.List[str], workingdir: str) -> T.Tuple[bool, str]: |