Skip to content

Commit a33daf3

Browse files
authored
Ensure temporary files have proper unique names for bazel builds. (#1415)
This attempts to fix #1386.
1 parent 8caaa25 commit a33daf3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bazel/emscripten_toolchain/link_wrapper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
final_bytes.extend((base_name + '.wasm.debug.wasm').encode())
140140

141141
# Write our length + filename bytes to a temp file.
142-
with open('debugsection.tmp', 'wb+') as f:
142+
with open(base_name + '_debugsection.tmp', 'wb+') as f:
143143
f.write(final_bytes)
144144
f.close()
145145

@@ -152,16 +152,16 @@
152152
subprocess.check_call([
153153
llvm_objcopy,
154154
wasm_base,
155-
'--add-section=external_debug_info=debugsection.tmp'])
155+
'--add-section=external_debug_info=' + base_name + '_debugsection.tmp'])
156156

157157
# Make sure we have at least one output file.
158158
if not len(files):
159159
print('emcc.py did not appear to output any known files!')
160160
sys.exit(1)
161161

162162
# cc_binary must output exactly one file; put all the output files in a tarball.
163-
cmd = ['tar', 'cf', 'tmp.tar'] + files
163+
cmd = ['tar', 'cf', base_name + '.tar'] + files
164164
subprocess.check_call(cmd, cwd=outdir)
165-
os.replace(os.path.join(outdir, 'tmp.tar'), output_file)
165+
os.replace(os.path.join(outdir, base_name + '.tar'), output_file)
166166

167167
sys.exit(0)

0 commit comments

Comments
 (0)