Merge branch 'bugfix/build_color_output_windows_v5.0' into 'release/v5.0'

tools: idf.py: use actual sys.stdout instead of the memoized one (v5.0)

See merge request espressif/esp-idf!20112
This commit is contained in:
Jiang Jiang Jian
2022-09-14 13:53:41 +08:00

View File

@@ -222,12 +222,12 @@ class RunTool:
if p.stderr and p.stdout: # it only to avoid None type in p.std
await asyncio.gather(
self.read_and_write_stream(p.stderr, stderr_output_file, sys.stderr),
self.read_and_write_stream(p.stdout, stdout_output_file))
self.read_and_write_stream(p.stdout, stdout_output_file, sys.stdout))
await p.wait() # added for avoiding None returncode
return p, stderr_output_file, stdout_output_file
async def read_and_write_stream(self, input_stream: asyncio.StreamReader, output_filename: str,
output_stream: TextIO=sys.stdout) -> None:
output_stream: TextIO) -> None:
"""read the output of the `input_stream` and then write it into `output_filename` and `output_stream`"""
def delete_ansi_escape(text: str) -> str:
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')