Skip to content

Commit f97f1ca

Browse files
addaleaxtargos
authored andcommitted
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 <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
1 parent b40eede commit f97f1ca

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/api/hooks.cc

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ void AtExit(Environment* env, void (*cb)(void* arg), void* arg) {
3030
}
3131

3232
void EmitBeforeExit(Environment* env) {
33+
env->RunBeforeExitCallbacks();
34+
3335
HandleScope handle_scope(env->isolate());
3436
Context::Scope context_scope(env->context());
3537
Local<Value> exit_code = env->process_object()

src/node_main_instance.cc

-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ int NodeMainInstance::Run() {
133133
more = uv_loop_alive(env->event_loop());
134134
if (more && !env->is_stopping()) continue;
135135

136-
env->RunBeforeExitCallbacks();
137-
138136
if (!uv_loop_alive(env->event_loop())) {
139137
EmitBeforeExit(env.get());
140138
}

0 commit comments

Comments
 (0)