Skip to content

Commit

Permalink
tools: allow test tap output to include unicode characters
Browse files Browse the repository at this point in the history
PR-URL: #47175
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
  • Loading branch information
MoLow authored and RafaelGSS committed Apr 7, 2023
1 parent 4530582 commit 78ce8d3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import multiprocessing
import errno
import copy
import io


if sys.version_info >= (3, 5):
Expand Down Expand Up @@ -1595,7 +1596,13 @@ def Main():
parser.print_help()
return 1

ch = logging.StreamHandler(sys.stdout)
stream = sys.stdout
try:
sys.stdout.reconfigure(encoding='utf8')
except AttributeError:
# Python < 3.7 does not have reconfigure
stream = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8')
ch = logging.StreamHandler(stream)
logger.addHandler(ch)
logger.setLevel(logging.INFO)
if options.logfile:
Expand Down

0 comments on commit 78ce8d3

Please sign in to comment.