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 /src/node_worker.cc | |
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 'src/node_worker.cc')
-rw-r--r-- | src/node_worker.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/node_worker.cc b/src/node_worker.cc index 7baa6f6b80f..4159a6efeda 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -348,7 +348,8 @@ void Worker::Run() { more = uv_loop_alive(&data.loop_); if (more && !is_stopped()) continue; - EmitBeforeExit(env_.get()); + if (EmitProcessBeforeExit(env_.get()).IsNothing()) + break; // Emit `beforeExit` if the loop became alive either after emitting // event, or after running some callbacks. @@ -364,7 +365,7 @@ void Worker::Run() { bool stopped = is_stopped(); if (!stopped) { env_->VerifyNoStrongBaseObjects(); - exit_code = EmitExit(env_.get()); + exit_code = EmitProcessExit(env_.get()).FromMaybe(1); } Mutex::ScopedLock lock(mutex_); if (exit_code_ == 0 && !stopped) |