diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-10-04 00:29:41 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-10-11 03:20:53 +0300 |
commit | 278d38f4cf3d2821984660b4de73f8d414db17c7 (patch) | |
tree | 60aef3854353c414d8371b6ac613debcba49585f /doc/api/embedding.md | |
parent | 275153ddc4fe0e49d5f73807edaa6eca0c3041cb (diff) |
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>
Diffstat (limited to 'doc/api/embedding.md')
-rw-r--r-- | doc/api/embedding.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/api/embedding.md b/doc/api/embedding.md index 71b8707389a..f38d5a7cabc 100644 --- a/doc/api/embedding.md +++ b/doc/api/embedding.md @@ -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, |