Skip to content

Commit

Permalink
src: run RunBeforeExitCallbacks as part of EmitBeforeExit
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Shelley Vohr <[email protected]>
  • Loading branch information
addaleax authored and targos committed Dec 1, 2019
1 parent b40eede commit f97f1ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/api/hooks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 0 additions & 2 deletions src/node_main_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,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());
}
Expand Down

0 comments on commit f97f1ca

Please sign in to comment.