mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
src: add maybe versions of EmitExit and EmitBeforeExit
This addresses a TODO comment, and removes invalid `.ToLocalChecked()` calls from our code base. PR-URL: https://github.com/nodejs/node/pull/35486 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
8 files changed
+104
-31
No files matched your search
@@ -181,9 +181,10 @@ int RunNodeInstance(MultiIsolatePlatform* platform,
|
||||
more = uv_loop_alive(&loop);
|
||||
if (more) continue;
|
||||
|
||||
// node::EmitBeforeExit() is used to emit the 'beforeExit' event on
|
||||
// the `process` object.
|
||||
node::EmitBeforeExit(env.get());
|
||||
// node::EmitProcessBeforeExit() is used to emit the 'beforeExit' event
|
||||
// on the `process` object.
|
||||
if (node::EmitProcessBeforeExit(env.get()).IsNothing())
|
||||
break;
|
||||
|
||||
// 'beforeExit' can also schedule new work that keeps the event loop
|
||||
// running.
|
||||
@@ -191,8 +192,8 @@ int RunNodeInstance(MultiIsolatePlatform* platform,
|
||||
} while (more == true);
|
||||
}
|
||||
|
||||
// node::EmitExit() returns the current exit code.
|
||||
exit_code = node::EmitExit(env.get());
|
||||
// node::EmitProcessExit() returns the current exit code.
|
||||
exit_code = node::EmitProcessExit(env.get()).FromMaybe(1);
|
||||
|
||||
// node::Stop() can be used to explicitly stop the event loop and keep
|
||||
// further JavaScript from running. It can be called from any thread,
|
||||
|
||||
Reference in new issue
Block a user