Skip to content

Commit 9347bc3

Browse files
Fix FileExistsError on subsequent bazel builds on Windows (#1326) (#1326)
Fixes #1181.
1 parent 8822664 commit 9347bc3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bazel/emscripten_toolchain/link_wrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
# If the output name has no extension, give it the appropriate extension.
6363
if not base_name_split[1]:
64-
os.rename(output_file, output_file + '.' + oformat)
64+
os.replace(output_file, output_file + '.' + oformat)
6565

6666
# If the output name does have an extension and it matches the output format,
6767
# change the base_name so it doesn't have an extension.
@@ -77,7 +77,7 @@
7777
# Please don't do that.
7878
else:
7979
base_name = base_name_split[0]
80-
os.rename(output_file, os.path.join(outdir, base_name + '.' + oformat))
80+
os.replace(output_file, os.path.join(outdir, base_name + '.' + oformat))
8181

8282
files = []
8383
extensions = [
@@ -161,6 +161,6 @@
161161
# cc_binary must output exactly one file; put all the output files in a tarball.
162162
cmd = ['tar', 'cf', 'tmp.tar'] + files
163163
subprocess.check_call(cmd, cwd=outdir)
164-
os.rename(os.path.join(outdir, 'tmp.tar'), output_file)
164+
os.replace(os.path.join(outdir, 'tmp.tar'), output_file)
165165

166166
sys.exit(0)

0 commit comments

Comments
 (0)