@@ -813,6 +813,7 @@ Environment::Environment(IsolateData* isolate_data,
813813 exec_argv_(exec_args),
814814 argv_(args),
815815 exec_path_(GetExecPath(args)),
816+ exiting_(isolate_, 1 , MAYBE_FIELD_PTR(env_info, exiting)),
816817 should_abort_on_uncaught_toggle_(
817818 isolate_,
818819 1 ,
@@ -919,6 +920,9 @@ void Environment::InitializeMainContext(Local<Context> context,
919920 // By default, always abort when --abort-on-uncaught-exception was passed.
920921 should_abort_on_uncaught_toggle_[0 ] = 1 ;
921922
923+ // The process is not exiting by default.
924+ set_exiting (false );
925+
922926 performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_ENVIRONMENT,
923927 environment_start_time_);
924928 performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_NODE_START,
@@ -1810,6 +1814,7 @@ EnvSerializeInfo Environment::Serialize(SnapshotCreator* creator) {
18101814 info.immediate_info = immediate_info_.Serialize (ctx, creator);
18111815 info.tick_info = tick_info_.Serialize (ctx, creator);
18121816 info.performance_state = performance_state_->Serialize (ctx, creator);
1817+ info.exiting = exiting_.Serialize (ctx, creator);
18131818 info.stream_base_state = stream_base_state_.Serialize (ctx, creator);
18141819 info.should_abort_on_uncaught_toggle =
18151820 should_abort_on_uncaught_toggle_.Serialize (ctx, creator);
@@ -1857,6 +1862,7 @@ std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& i) {
18571862 << " // -- performance_state begins --\n "
18581863 << i.performance_state << " ,\n "
18591864 << " // -- performance_state ends --\n "
1865+ << i.exiting << " , // exiting\n "
18601866 << i.stream_base_state << " , // stream_base_state\n "
18611867 << i.should_abort_on_uncaught_toggle
18621868 << " , // should_abort_on_uncaught_toggle\n "
@@ -1900,6 +1906,7 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
19001906 immediate_info_.Deserialize (ctx);
19011907 tick_info_.Deserialize (ctx);
19021908 performance_state_->Deserialize (ctx);
1909+ exiting_.Deserialize (ctx);
19031910 stream_base_state_.Deserialize (ctx);
19041911 should_abort_on_uncaught_toggle_.Deserialize (ctx);
19051912
@@ -2120,6 +2127,7 @@ void Environment::MemoryInfo(MemoryTracker* tracker) const {
21202127 native_modules_without_cache);
21212128 tracker->TrackField (" destroy_async_id_list" , destroy_async_id_list_);
21222129 tracker->TrackField (" exec_argv" , exec_argv_);
2130+ tracker->TrackField (" exiting" , exiting_);
21232131 tracker->TrackField (" should_abort_on_uncaught_toggle" ,
21242132 should_abort_on_uncaught_toggle_);
21252133 tracker->TrackField (" stream_base_state" , stream_base_state_);
0 commit comments