Skip to content

Commit 906d279

Browse files
addaleaxMylesBorins
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 66b3619 commit 906d279

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
@@ -140,8 +140,6 @@ int NodeMainInstance::Run() {
140140
more = uv_loop_alive(env->event_loop());
141141
if (more && !env->is_stopping()) continue;
142142

143-
env->RunBeforeExitCallbacks();
144-
145143
if (!uv_loop_alive(env->event_loop())) {
146144
EmitBeforeExit(env.get());
147145
}

0 commit comments

Comments
 (0)