From 14f049ddd1ff0801f12f7a2781a2caaaa5b9e81f Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 3 Dec 2019 17:55:51 +0100 Subject: [PATCH] Fix Python Unicode error on macOS CI --- python/servo/testing_commands.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 710924669c9..01cdc14db30 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -563,9 +563,12 @@ class MachCommands(CommandBase): else: actual_failures.append(failure["output"]) - def format(outputs, description, file=sys.stdout): - print(len(outputs), description + ":\n", file=file) - file.write('\n'.join(outputs).encode("utf-8")) + def format(outputs, description, file=None): + formatted = "%s %s:\n%s" % (len(outputs), description, "\n".join(outputs)) + if file: + file.write(formatted.encode("utf-8")) + else: + print(formatted) if log_intermittents: with open(log_intermittents, "wb") as file: