@@ -4047,10 +4047,11 @@ void EmitBeforeExit(Environment* env) {
40474047 HandleScope handle_scope (env->isolate ());
40484048 Context::Scope context_scope (env->context ());
40494049 Local<Object> process_object = env->process_object ();
4050- Local<String> exit_code = FIXED_ONE_BYTE_STRING ( env->isolate (), " exitCode " );
4050+ Local<String> exit_code = env->exit_code_string ( );
40514051 Local<Value> args[] = {
40524052 FIXED_ONE_BYTE_STRING (env->isolate (), " beforeExit" ),
4053- process_object->Get (exit_code)->ToInteger (env->context ()).ToLocalChecked ()
4053+ process_object->Get (env->context (), exit_code).ToLocalChecked ()
4054+ ->ToInteger (env->context ()).ToLocalChecked ()
40544055 };
40554056 MakeCallback (env->isolate (),
40564057 process_object, " emit" , arraysize (args), args,
@@ -4063,13 +4064,15 @@ int EmitExit(Environment* env) {
40634064 HandleScope handle_scope (env->isolate ());
40644065 Context::Scope context_scope (env->context ());
40654066 Local<Object> process_object = env->process_object ();
4066- process_object->Set (env->exiting_string (), True (env->isolate ()));
4067+ process_object->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " _exiting" ),
4068+ True (env->isolate ()));
40674069
4068- Local<String> exitCode = env->exit_code_string ();
4069- int code = process_object->Get (exitCode)->Int32Value ();
4070+ Local<String> exit_code = env->exit_code_string ();
4071+ int code = process_object->Get (env->context (), exit_code).ToLocalChecked ()
4072+ ->Int32Value (env->context ()).ToChecked ();
40704073
40714074 Local<Value> args[] = {
4072- env->exit_string ( ),
4075+ FIXED_ONE_BYTE_STRING ( env->isolate (), " exit " ),
40734076 Integer::New (env->isolate (), code)
40744077 };
40754078
@@ -4078,7 +4081,8 @@ int EmitExit(Environment* env) {
40784081 {0 , 0 }).ToLocalChecked ();
40794082
40804083 // Reload exit code, it may be changed by `emit('exit')`
4081- return process_object->Get (exitCode)->Int32Value ();
4084+ return process_object->Get (env->context (), exit_code).ToLocalChecked ()
4085+ ->Int32Value (env->context ()).ToChecked ();
40824086}
40834087
40844088
0 commit comments