Skip to content

Commit 8f2dfeb

Browse files
authored
Use write_file utility when creating audio worklet output. NFC (#19576)
This matches the surrounding code, and paves the way for a refactor.
1 parent 5b9aace commit 8f2dfeb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

emcc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3226,13 +3226,13 @@ def phase_final_emitting(options, state, target, wasm_target, memfile):
32263226
# Deploy the Audio Worklet module bootstrap file (*.aw.js)
32273227
if settings.AUDIO_WORKLET == 1:
32283228
worklet_output = os.path.join(target_dir, settings.AUDIO_WORKLET_FILE)
3229-
with open(worklet_output, 'w') as f:
3230-
f.write(shared.read_and_preprocess(shared.path_from_root('src', 'audio_worklet.js'), expand_macros=True))
3229+
contents = shared.read_and_preprocess(shared.path_from_root('src', 'audio_worklet.js'), expand_macros=True)
3230+
utils.write_file(worklet_output, contents)
32313231

32323232
# Minify the audio_worklet.js file in optimized builds
32333233
if (settings.OPT_LEVEL >= 1 or settings.SHRINK_LEVEL >= 1) and not settings.DEBUG_LEVEL:
32343234
minified_worker = building.acorn_optimizer(worklet_output, ['minifyWhitespace'], return_output=True)
3235-
open(worklet_output, 'w').write(minified_worker)
3235+
utils.write_file(worklet_output, minified_worker)
32363236

32373237
if settings.MODULARIZE:
32383238
modularize()

0 commit comments

Comments
 (0)