Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
binaryen.js: Avoid catching exit/rejection which confuses Node error …
…reporting
  • Loading branch information
kripken committed Jul 17, 2024
commit 58e24831cd35d3320c9830abdd21ef551858deea
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ if(EMSCRIPTEN)
target_link_libraries(binaryen_wasm optimized "-Wno-error=closure")
target_link_libraries(binaryen_wasm optimized "-flto")
target_link_libraries(binaryen_wasm debug "--profiling")
# Avoid catching exit/rejection as that can confuse error reporting in Node,
# see https://github.com/emscripten-core/emscripten/issues/17228
target_link_libraries(binaryen_wasm "-sNODEJS_CATCH_EXIT=0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in the process of trying to disable this by default, but this change lgtm either way.

target_link_libraries(binaryen_wasm "-sNODEJS_CATCH_REJECTION=0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NODEJS_CATCH_REJECTION is no longer needed here since it already defaults to 0 when targetting node > 15 (which is the default).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I verified it still works that way. Pushed.

install(TARGETS binaryen_wasm DESTINATION ${CMAKE_INSTALL_BINDIR})

# binaryen.js JavaScript variant
Expand Down Expand Up @@ -550,6 +554,10 @@ if(EMSCRIPTEN)
target_link_libraries(binaryen_js optimized "-flto")
target_link_libraries(binaryen_js debug "--profiling")
target_link_libraries(binaryen_js debug "-sASSERTIONS")
# Avoid catching exit/rejection as that can confuse error reporting in Node,
# see https://github.com/emscripten-core/emscripten/issues/17228
target_link_libraries(binaryen_js "-sNODEJS_CATCH_EXIT=0")
target_link_libraries(binaryen_js "-sNODEJS_CATCH_REJECTION=0")
install(TARGETS binaryen_js DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

Expand Down