@@ -4117,10 +4117,11 @@ void EmitBeforeExit(Environment* env) {
41174117 HandleScope handle_scope (env->isolate ());
41184118 Context::Scope context_scope (env->context ());
41194119 Local<Object> process_object = env->process_object ();
4120- Local<String> exit_code = FIXED_ONE_BYTE_STRING ( env->isolate (), " exitCode " );
4120+ Local<String> exit_code = env->exit_code_string ( );
41214121 Local<Value> args[] = {
41224122 FIXED_ONE_BYTE_STRING (env->isolate (), " beforeExit" ),
4123- process_object->Get (exit_code)->ToInteger (env->context ()).ToLocalChecked ()
4123+ process_object->Get (env->context (), exit_code).ToLocalChecked ()
4124+ ->ToInteger (env->context ()).ToLocalChecked ()
41244125 };
41254126 MakeCallback (env->isolate (),
41264127 process_object, " emit" , arraysize (args), args,
@@ -4133,13 +4134,15 @@ int EmitExit(Environment* env) {
41334134 HandleScope handle_scope (env->isolate ());
41344135 Context::Scope context_scope (env->context ());
41354136 Local<Object> process_object = env->process_object ();
4136- process_object->Set (env->exiting_string (), True (env->isolate ()));
4137+ process_object->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " _exiting" ),
4138+ True (env->isolate ()));
41374139
4138- Local<String> exitCode = env->exit_code_string ();
4139- int code = process_object->Get (exitCode)->Int32Value ();
4140+ Local<String> exit_code = env->exit_code_string ();
4141+ int code = process_object->Get (env->context (), exit_code).ToLocalChecked ()
4142+ ->Int32Value (env->context ()).ToChecked ();
41404143
41414144 Local<Value> args[] = {
4142- env->exit_string ( ),
4145+ FIXED_ONE_BYTE_STRING ( env->isolate (), " exit " ),
41434146 Integer::New (env->isolate (), code)
41444147 };
41454148
@@ -4148,7 +4151,8 @@ int EmitExit(Environment* env) {
41484151 {0 , 0 }).ToLocalChecked ();
41494152
41504153 // Reload exit code, it may be changed by `emit('exit')`
4151- return process_object->Get (exitCode)->Int32Value ();
4154+ return process_object->Get (env->context (), exit_code).ToLocalChecked ()
4155+ ->Int32Value (env->context ()).ToChecked ();
41524156}
41534157
41544158
0 commit comments