Skip to content

Commit 8cf5ec4

Browse files
authored
Move handling of EMCC_STDERR_FILE to where its used. NFC. (#13503)
1 parent 50fe0fd commit 8cf5ec4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

emscripten.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@
2828

2929
logger = logging.getLogger('emscripten')
3030

31-
STDERR_FILE = os.environ.get('EMCC_STDERR_FILE')
32-
if STDERR_FILE:
33-
STDERR_FILE = os.path.abspath(STDERR_FILE)
34-
logger.info('logging stderr in js compiler phase into %s' % STDERR_FILE)
35-
STDERR_FILE = open(STDERR_FILE, 'w')
36-
3731
WASM_INIT_FUNC = '__wasm_call_ctors'
3832

3933

@@ -159,6 +153,12 @@ def apply_static_code_hooks(forwarded_json, code):
159153

160154

161155
def compile_settings():
156+
stderr_file = os.environ.get('EMCC_STDERR_FILE')
157+
if stderr_file:
158+
stderr_file = os.path.abspath(stderr_file)
159+
logger.info('logging stderr in js compiler phase into %s' % stderr_file)
160+
stderr_file = open(stderr_file, 'w')
161+
162162
# Save settings to a file to work around v8 issue 1579
163163
with shared.configuration.get_temp_files().get_file('.txt') as settings_file:
164164
with open(settings_file, 'w') as s:
@@ -168,7 +168,7 @@ def compile_settings():
168168
env = os.environ.copy()
169169
env['EMCC_BUILD_DIR'] = os.getcwd()
170170
out = shared.run_js_tool(path_from_root('src', 'compiler.js'),
171-
[settings_file], stdout=subprocess.PIPE, stderr=STDERR_FILE,
171+
[settings_file], stdout=subprocess.PIPE, stderr=stderr_file,
172172
cwd=path_from_root('src'), env=env)
173173
assert '//FORWARDED_DATA:' in out, 'Did not receive forwarded data in pre output - process failed?'
174174
glue, forwarded_data = out.split('//FORWARDED_DATA:')

0 commit comments

Comments
 (0)