mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
Merge branch 'fix/runtool_crcrlf_v5.2' into 'release/v5.2'
fix: save RunTool command output with correct line endings (v5.2) See merge request espressif/esp-idf!28677
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
import asyncio
|
import asyncio
|
||||||
import importlib
|
import importlib
|
||||||
@@ -8,10 +8,17 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from asyncio.subprocess import Process
|
from asyncio.subprocess import Process
|
||||||
from io import open
|
|
||||||
from pkgutil import iter_modules
|
from pkgutil import iter_modules
|
||||||
from types import FunctionType
|
from types import FunctionType
|
||||||
from typing import Any, Dict, Generator, List, Match, Optional, TextIO, Tuple, Union
|
from typing import Any
|
||||||
|
from typing import Dict
|
||||||
|
from typing import Generator
|
||||||
|
from typing import List
|
||||||
|
from typing import Match
|
||||||
|
from typing import Optional
|
||||||
|
from typing import TextIO
|
||||||
|
from typing import Tuple
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import yaml
|
import yaml
|
||||||
@@ -404,7 +411,11 @@ class RunTool:
|
|||||||
is_progression_processing_enabled = self.force_progression and output_stream.isatty() and '-v' not in self.args
|
is_progression_processing_enabled = self.force_progression and output_stream.isatty() and '-v' not in self.args
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(output_filename, 'w', encoding='utf8') as output_file:
|
# The command output from asyncio stream already contains OS specific line ending,
|
||||||
|
# because it's read in as bytes and decoded to string. On Windows "output" already
|
||||||
|
# contains CRLF. Use "newline=''" to prevent python to convert CRLF into CRCRLF.
|
||||||
|
# Please see "newline" description at https://docs.python.org/3/library/functions.html#open
|
||||||
|
with open(output_filename, 'w', encoding='utf8', newline='') as output_file:
|
||||||
while True:
|
while True:
|
||||||
if self.interactive:
|
if self.interactive:
|
||||||
output = await read_interactive_stream()
|
output = await read_interactive_stream()
|
||||||
|
Reference in New Issue
Block a user