★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/906d279e69Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files
src: run RunBeforeExitCallbacks as part of EmitBeforeExit
This is part of a series of changes to make embedding easier, by
requiring fewer internal methods to build a fully functioning
Node.js instance.

This also aligns the worker_threads code with the main thread code.

PR-URL: #30229
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
  • Loading branch information
addaleax authored and MylesBorins committed Nov 17, 2019
1 parent 66b3619 commit 906d279e697af654cb731d3ca9079bb3c52080e7
Showing with 2 additions and 2 deletions.
  1. +2 −0 src/api/hooks.cc
  2. +0 −2 src/node_main_instance.cc
@@ -30,6 +30,8 @@ void AtExit(Environment* env, void (*cb)(void* arg), void* arg) {
}

void EmitBeforeExit(Environment* env) {
env->RunBeforeExitCallbacks();

HandleScope handle_scope(env->isolate());
Context::Scope context_scope(env->context());
Local<Value> exit_code = env->process_object()
@@ -140,8 +140,6 @@ int NodeMainInstance::Run() {
more = uv_loop_alive(env->event_loop());
if (more && !env->is_stopping()) continue;

env->RunBeforeExitCallbacks();

if (!uv_loop_alive(env->event_loop())) {
EmitBeforeExit(env.get());
}

0 comments on commit 906d279

Please sign in to comment.