Re-enable EXIT_RUNTIME to replace emscripten_force_exit
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
f2347725e1
commit
375f10acb3
|
@ -78,7 +78,7 @@ if (${IS_GNU} OR ${IS_CLANG})
|
|||
else()
|
||||
set(IS_HOST_NOT_ANDROID 0)
|
||||
endif()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "--closure 1 -lnodefs.js -lembind -sFORCE_FILESYSTEM=1 -sWASM=0 --memory-init-file 0 -sEXPORTED_FUNCTIONS=_main -sEXIT_RUNTIME=0 -sSINGLE_FILE=1 -sSAFE_HEAP=${IS_HOST_NOT_ANDROID} -sABORTING_MALLOC=0 -sJS_MATH=1 -sENVIRONMENT='web,webview,worker,node,shell' -sNODEJS_CATCH_EXIT=0 -sSTRICT=1 -sMINIMAL_RUNTIME=0 -sDISABLE_EXCEPTION_CATCHING=0 -sALLOW_MEMORY_GROWTH=1 -Wno-pthreads-mem-growth -sMEMORY_GROWTH_GEOMETRIC_STEP=0 -sDECLARE_ASM_MODULE_EXPORTS=0 ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "--closure 1 -lnodefs.js -lembind -sFORCE_FILESYSTEM=1 -sWASM=0 --memory-init-file 0 -sEXPORTED_FUNCTIONS=_main -sEXIT_RUNTIME=1 -sSINGLE_FILE=1 -sSAFE_HEAP=${IS_HOST_NOT_ANDROID} -sABORTING_MALLOC=0 -sJS_MATH=1 -sENVIRONMENT='web,webview,worker,node,shell' -sNODEJS_CATCH_EXIT=0 -sSTRICT=1 -sMINIMAL_RUNTIME=0 -sDISABLE_EXCEPTION_CATCHING=0 -sALLOW_MEMORY_GROWTH=1 -Wno-pthreads-mem-growth -sMEMORY_GROWTH_GEOMETRIC_STEP=0 -sDECLARE_ASM_MODULE_EXPORTS=0 ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
if (CMAKE_USE_PTHREADS_INIT)
|
||||
set(CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}") # Emscripten requires the -pthread flag
|
||||
set(CMAKE_EXE_LINKER_FLAGS "--closure-args=\"--compilation_level SIMPLE\" -sPROXY_TO_PTHREAD=1 ${CMAKE_EXE_LINKER_FLAGS}") # See https://github.com/emscripten-core/emscripten/issues/16706
|
||||
|
|
|
@ -35,11 +35,12 @@
|
|||
#ifdef EMSCRIPTEN
|
||||
#include <emscripten.h>
|
||||
static bool is_node;
|
||||
void exit(int status) {
|
||||
void emscripten_exit(int status) {
|
||||
MAIN_THREAD_EM_ASM("yerbacon_output = Module.get_cout();");
|
||||
if (is_node) emscripten_force_exit(status); else emscripten_exit_with_live_runtime();
|
||||
if (not is_node) emscripten_exit_with_live_runtime();
|
||||
std::exit(status);
|
||||
}
|
||||
#define exit(status) emscripten_exit(status)
|
||||
#include <sstream>
|
||||
static std::ostringstream string_cout;
|
||||
#define cout (is_node ? std::cout : string_cout)
|
||||
|
|
Loading…
Reference in New Issue