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.
This commit is contained in:
parent
e962147d8a
commit
06dddf2ef0
|
@ -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]:
|
||||
|
|
Loading…
Reference in New Issue