28
28
29
29
logger = logging .getLogger ('emscripten' )
30
30
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
-
37
31
WASM_INIT_FUNC = '__wasm_call_ctors'
38
32
39
33
@@ -159,6 +153,12 @@ def apply_static_code_hooks(forwarded_json, code):
159
153
160
154
161
155
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
+
162
162
# Save settings to a file to work around v8 issue 1579
163
163
with shared .configuration .get_temp_files ().get_file ('.txt' ) as settings_file :
164
164
with open (settings_file , 'w' ) as s :
@@ -168,7 +168,7 @@ def compile_settings():
168
168
env = os .environ .copy ()
169
169
env ['EMCC_BUILD_DIR' ] = os .getcwd ()
170
170
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 ,
172
172
cwd = path_from_root ('src' ), env = env )
173
173
assert '//FORWARDED_DATA:' in out , 'Did not receive forwarded data in pre output - process failed?'
174
174
glue , forwarded_data = out .split ('//FORWARDED_DATA:' )
0 commit comments