Close lua state when exiting on a runtime error (#1487)
* Close lua state when exiting on a runtime error * This change allows calling the garbage collector before exiting the application for a cleaner shutdown. * Components like the shared memory object on #1486 will have a better chance at destroying no longer needed resources. * Overriden os.exit to always close the state * Allow setting close param on os.exit override * Simplified the os.exit override a bit more Co-authored-by: Guldoman <giulio.lettieri@gmail.com> --------- Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
This commit is contained in:
parent
2a9b367e13
commit
6c17f6e2ee
|
@ -225,6 +225,10 @@ init_lua:
|
||||||
|
|
||||||
const char *init_lite_code = \
|
const char *init_lite_code = \
|
||||||
"local core\n"
|
"local core\n"
|
||||||
|
"local os_exit = os.exit\n"
|
||||||
|
"os.exit = function(code, close)\n"
|
||||||
|
" os_exit(code, close == nil and true or close)\n"
|
||||||
|
"end\n"
|
||||||
"xpcall(function()\n"
|
"xpcall(function()\n"
|
||||||
" local match = require('utf8extra').match\n"
|
" local match = require('utf8extra').match\n"
|
||||||
" HOME = os.getenv('" LITE_OS_HOME "')\n"
|
" HOME = os.getenv('" LITE_OS_HOME "')\n"
|
||||||
|
|
Loading…
Reference in New Issue