Skip to content

Commit 5b23199

Browse files
authored
use a temp dir in embuilder, do not assume just a single temp file is created (emscripten-core#6400)
there may be a wasm file as well, eventually
1 parent e57fd75 commit 5b23199

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

embuilder.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,12 @@ def build(src, result_libs, args=[]):
124124
del os.environ['EMCC_FORCE_STDLIBS']
125125

126126
# build in order to generate the libraries
127-
with temp_files.get_file('.cpp') as temp:
128-
open(temp, 'w').write(src)
129-
temp_js = temp_files.get('.js').name
130-
shared.Building.emcc(temp, args, output_filename=temp_js)
127+
# do it all in a temp dir where everything will be cleaned up
128+
temp_dir = temp_files.get_dir()
129+
cpp = os.path.join(temp_dir, 'src.cpp')
130+
open(cpp, 'w').write(src)
131+
temp_js = os.path.join(temp_dir, 'out.js')
132+
shared.Building.emcc(cpp, args, output_filename=temp_js)
131133

132134
# verify
133135
assert os.path.exists(temp_js), 'failed to build file'

0 commit comments

Comments
 (0)