From 044f62d1a176bba8c6fa3997be0972eba11c5fdd Mon Sep 17 00:00:00 2001 From: "Zeyi (Rice) Fan" Date: Mon, 22 Jun 2020 19:01:02 -0700 Subject: [PATCH] fix encoding bug Summary: This bug can be triggered when your computer name contains emoji. getdeps.py will fail to create this file due to Python attempts to write the file as cp1252 (Windows's default encoding) Reviewed By: wez Differential Revision: D22171935 fbshipit-source-id: fc3be2d1050c17ddbe05a0fc91d6613865f092ce --- build/fbcode_builder/getdeps/builder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/fbcode_builder/getdeps/builder.py b/build/fbcode_builder/getdeps/builder.py index 308f1c854..5e7b20f2d 100644 --- a/build/fbcode_builder/getdeps/builder.py +++ b/build/fbcode_builder/getdeps/builder.py @@ -412,8 +412,8 @@ if __name__ == "__main__": # CMake manually. build_script_path = os.path.join(self.build_dir, "run_cmake.py") script_contents = self.MANUAL_BUILD_SCRIPT.format(**kwargs) - with open(build_script_path, "w") as f: - f.write(script_contents) + with open(build_script_path, "wb") as f: + f.write(script_contents.encode()) os.chmod(build_script_path, 0o755) def _compute_cmake_define_args(self, env):