Skip to content

Commit 018e16f

Browse files
authored
embind - Remove node exception handling flag for node 17+. (#21411)
Fixes: #21405
1 parent b5b7fed commit 018e16f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tools/link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,7 @@ def run_embind_gen(wasm_target, js_syms, extra_settings):
19261926
if settings.MEMORY64:
19271927
node_args += shared.node_memory64_flags()
19281928
if settings.WASM_EXCEPTIONS:
1929-
node_args += shared.node_exception_flags()
1929+
node_args += shared.node_exception_flags(config.NODE_JS)
19301930
# Run the generated JS file with the proper flags to generate the TypeScript bindings.
19311931
out = shared.run_js_tool(outfile_js, [], node_args, stdout=PIPE)
19321932
settings.restore(original_settings)

tools/shared.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,13 @@ def node_memory64_flags():
397397
return ['--experimental-wasm-memory64']
398398

399399

400-
def node_exception_flags():
401-
return ['--experimental-wasm-eh']
400+
def node_exception_flags(nodejs):
401+
node_version = get_node_version(nodejs)
402+
# Exception handling was enabled by default in node v17.
403+
if node_version and node_version < (17, 0, 0):
404+
return ['--experimental-wasm-eh']
405+
else:
406+
return []
402407

403408

404409
def node_pthread_flags(nodejs):

0 commit comments

Comments
 (0)