Skip to content

Commit b3d2c37

Browse files
committed
Remove Node uncaughtException handler
Fixes kripken/sql.js/sql-js#173 Fixes kripken/sql.js/sql-js#262
1 parent b4df241 commit b3d2c37

10 files changed

+34
-58
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ EMCC=emcc
1010
CFLAGS=-O2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DISABLE_LFS -DLONGDOUBLE_TYPE=double -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS
1111

1212
# When compiling to WASM, enabling memory-growth is not expected to make much of an impact, so we enable it for all builds
13+
# Since tihs is a library and not a standalone executable, we don't want to catch unhandled Node process exceptions
14+
# So, we do : `NODEJS_CATCH_EXIT=0`, which fixes issue: https://github.com/kripken/sql.js/issues/173 and https://github.com/kripken/sql.js/issues/262
1315
EMFLAGS = \
1416
--memory-init-file 0 \
1517
-s RESERVED_FUNCTION_POINTERS=64 \
1618
-s EXPORTED_FUNCTIONS=@exported_functions \
1719
-s EXTRA_EXPORTED_RUNTIME_METHODS=@exported_runtime_methods \
18-
-s SINGLE_FILE=0
20+
-s SINGLE_FILE=0 \
21+
-s NODEJS_CATCH_EXIT=0
1922

2023
EMFLAGS_WASM = \
2124
-s WASM=1 \

dist/sql-asm-debug.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,12 +1030,6 @@ if (ENVIRONMENT_IS_NODE) {
10301030
module['exports'] = Module;
10311031
}
10321032

1033-
process['on']('uncaughtException', function(ex) {
1034-
// suppress ExitStatus exceptions from showing an error
1035-
if (!(ex instanceof ExitStatus)) {
1036-
throw ex;
1037-
}
1038-
});
10391033
// Currently node will swallow unhandled rejections, but this behavior is
10401034
// deprecated, and in the future it will exit with error status.
10411035
process['on']('unhandledRejection', abort);

dist/sql-asm-memory-growth.js

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sql-asm.js

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sql-wasm-debug.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,12 +1027,6 @@ if (ENVIRONMENT_IS_NODE) {
10271027
module['exports'] = Module;
10281028
}
10291029

1030-
process['on']('uncaughtException', function(ex) {
1031-
// suppress ExitStatus exceptions from showing an error
1032-
if (!(ex instanceof ExitStatus)) {
1033-
throw ex;
1034-
}
1035-
});
10361030
// Currently node will swallow unhandled rejections, but this behavior is
10371031
// deprecated, and in the future it will exit with error status.
10381032
process['on']('unhandledRejection', abort);

0 commit comments

Comments
 (0)