diff --git a/bazel/emscripten_toolchain/link_wrapper.py b/bazel/emscripten_toolchain/link_wrapper.py index d6b715dbae..ca6ca48fd8 100644 --- a/bazel/emscripten_toolchain/link_wrapper.py +++ b/bazel/emscripten_toolchain/link_wrapper.py @@ -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. @@ -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 = [ @@ -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)