Skip to content

Commit 71fa584

Browse files
Write run_tests console logs to stdout instead of stderr (flutter#56312)
Users of this script typically expect that the normal output of the tests will be written to stdout. However, the logging.StreamHandler writes to stderr by default unless another stream is specified.
1 parent 3565517 commit 71fa584

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎testing/run_tests.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Explicitly import the parts of sys that are needed. This is to avoid using
2424
# sys.stdout and sys.stderr directly. Instead, only the logger defined below
2525
# should be used for output.
26-
from sys import exit as sys_exit, platform as sys_platform, path as sys_path
26+
from sys import exit as sys_exit, platform as sys_platform, path as sys_path, stdout as sys_stdout
2727
import tempfile
2828
import time
2929
import typing
@@ -45,7 +45,8 @@
4545

4646
LOG_FILE = os.path.join(OUT_DIR, 'run_tests.log')
4747
logger = logging.getLogger(__name__)
48-
console_logger_handler = logging.StreamHandler()
48+
# Write console logs to stdout (by default StreamHandler uses stderr)
49+
console_logger_handler = logging.StreamHandler(sys_stdout)
4950
file_logger_handler = logging.FileHandler(LOG_FILE)
5051

5152

0 commit comments

Comments
 (0)