From d24086c5295a6830f18e6f615f6497d314b4be95 Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Fri, 4 Oct 2019 12:15:19 +0200 Subject: [PATCH] tools: Fix idf.py menuconfig characters in MSYS2 --- tools/idf.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tools/idf.py b/tools/idf.py index 406b45a3d..6a8ec7ec5 100755 --- a/tools/idf.py +++ b/tools/idf.py @@ -1529,13 +1529,18 @@ if __name__ == "__main__": if ("MSYSTEM" in os.environ) and ( not os.environ.get("_", "").endswith(WINPTY_EXE) and WINPTY_VAR not in os.environ ): - os.environ[WINPTY_VAR] = "1" # the value is of no interest to us - # idf.py calls itself with "winpty" and WINPTY global variable set - ret = subprocess.call( - [WINPTY_EXE, sys.executable] + sys.argv, env=os.environ - ) - if ret: - raise SystemExit(ret) + + if 'menuconfig' in sys.argv: + # don't use winpty for menuconfig because it will print weird characters + main() + else: + os.environ[WINPTY_VAR] = "1" # the value is of no interest to us + # idf.py calls itself with "winpty" and WINPTY global variable set + ret = subprocess.call( + [WINPTY_EXE, sys.executable] + sys.argv, env=os.environ + ) + if ret: + raise SystemExit(ret) elif os.name == "posix" and not _valid_unicode_config(): # Trying to find best utf-8 locale available on the system and restart python with it