Commit 4731bb0c authored by Chad Austin's avatar Chad Austin Committed by Facebook GitHub Bot

always write log files as UTF-8 to avoid cp1252 encoding errors

Summary:
The log file should be opened with a defined encoding rather than
whatever the platform default is. On Windows, that might be cp1252,
which throws an encoding error when the text is unicode.

Reviewed By: genevievehelsel

Differential Revision: D26025779

fbshipit-source-id: 0102b2555e91812dfe94a7c332eb896ca2c9ef7e
parent 3fb7ce4f
......@@ -51,7 +51,7 @@ def run_cmd(cmd, env=None, cwd=None, allow_fail=False, log_file=None):
sys.stdout.buffer.write(msg.encode(errors="surrogateescape"))
if log_file is not None:
with open(log_file, "a", errors="surrogateescape") as log:
with open(log_file, "a", encoding="utf-8") as log:
def log_function(msg):
log.write(msg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment