Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FileExistsError on subsequent bazel builds on Windows #1326

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bazel/emscripten_toolchain/link_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

# 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.
Expand All @@ -77,7 +77,7 @@
# 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 = [
Expand Down Expand Up @@ -161,6 +161,6 @@
# 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)