Skip to content

Commit

Permalink
fix(scripting/v8node): 'clean' process exit handler
Browse files Browse the repository at this point in the history
The default handler would crash instead of exit so instead we use
FatalError to cleanly crash.
  • Loading branch information
blattersturm committed Jun 12, 2023
1 parent 6e54fc9 commit cb97fbc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/components/citizen-scripting-v8/src/V8ScriptRuntime.cpp
Expand Up @@ -2180,6 +2180,11 @@ global.require = m.exports.require;
)"
);

node::SetProcessExitHandler(env, [](node::Environment*, int exitCode)
{
FatalError("Node.js exiting (exit code %d)\nSee console for details", exitCode);
});

g_envRuntimes[env] = this;

m_nodeEnvironment = env;
Expand Down

0 comments on commit cb97fbc

Please sign in to comment.