Skip to content

Commit 6b93a84

Browse files
authored
binaryen.js: Avoid catching exit, which confuses Node error reporting (#6764)
Fixes emscripten-core/emscripten#17228 This seems the right default in binaryen.js which is used as a library through npm mostly. We aren't a main program that wants to control node exclusively.
1 parent 29746f1 commit 6b93a84

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ if(EMSCRIPTEN)
500500
target_link_libraries(binaryen_wasm optimized "-Wno-error=closure")
501501
target_link_libraries(binaryen_wasm optimized "-flto")
502502
target_link_libraries(binaryen_wasm debug "--profiling")
503+
# Avoid catching exit as that can confuse error reporting in Node,
504+
# see https://github.com/emscripten-core/emscripten/issues/17228
505+
target_link_libraries(binaryen_wasm "-sNODEJS_CATCH_EXIT=0")
503506
install(TARGETS binaryen_wasm DESTINATION ${CMAKE_INSTALL_BINDIR})
504507

505508
# binaryen.js JavaScript variant
@@ -550,6 +553,9 @@ if(EMSCRIPTEN)
550553
target_link_libraries(binaryen_js optimized "-flto")
551554
target_link_libraries(binaryen_js debug "--profiling")
552555
target_link_libraries(binaryen_js debug "-sASSERTIONS")
556+
# Avoid catching exit as that can confuse error reporting in Node,
557+
# see https://github.com/emscripten-core/emscripten/issues/17228
558+
target_link_libraries(binaryen_js "-sNODEJS_CATCH_EXIT=0")
553559
install(TARGETS binaryen_js DESTINATION ${CMAKE_INSTALL_BINDIR})
554560
endif()
555561

0 commit comments

Comments
 (0)