From 9347bc393b94a17b93450bbc98bc3f66cef2aeb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2h=D0=BEm=D0=B0s=20Ll?= Date: Wed, 27 Dec 2023 13:21:55 -0800 Subject: [PATCH] Fix FileExistsError on subsequent bazel builds on Windows (#1326) (#1326) Fixes #1181. --- bazel/emscripten_toolchain/link_wrapper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/emscripten_toolchain/link_wrapper.py b/bazel/emscripten_toolchain/link_wrapper.py index d6b715d..ca6ca48 100644 --- a/bazel/emscripten_toolchain/link_wrapper.py +++ b/bazel/emscripten_toolchain/link_wrapper.py @@ -61,7 +61,7 @@ if oformat is not None: # If the output name has no extension, give it the appropriate extension. if not base_name_split[1]: - os.rename(output_file, output_file + '.' + oformat) + os.replace(output_file, output_file + '.' + oformat) # If the output name does have an extension and it matches the output format, # change the base_name so it doesn't have an extension. @@ -77,7 +77,7 @@ if oformat is not None: # Please don't do that. else: base_name = base_name_split[0] - os.rename(output_file, os.path.join(outdir, base_name + '.' + oformat)) + os.replace(output_file, os.path.join(outdir, base_name + '.' + oformat)) files = [] extensions = [ @@ -161,6 +161,6 @@ if not len(files): # cc_binary must output exactly one file; put all the output files in a tarball. cmd = ['tar', 'cf', 'tmp.tar'] + files subprocess.check_call(cmd, cwd=outdir) -os.rename(os.path.join(outdir, 'tmp.tar'), output_file) +os.replace(os.path.join(outdir, 'tmp.tar'), output_file) sys.exit(0)