Skip to content

Commit 5ab476f

Browse files
chadaustinfacebook-github-bot
authored andcommitted
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
1 parent 6a4d5a7 commit 5ab476f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

build/fbcode_builder/getdeps/runcmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def log_to_stdout(msg):
5151
sys.stdout.buffer.write(msg.encode(errors="surrogateescape"))
5252

5353
if log_file is not None:
54-
with open(log_file, "a", errors="surrogateescape") as log:
54+
with open(log_file, "a", encoding="utf-8") as log:
5555

5656
def log_function(msg):
5757
log.write(msg)

0 commit comments

Comments
 (0)