@@ -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 ,
@@ -920,6 +921,9 @@ void Environment::InitializeMainContext(Local<Context> context,
920921 // By default, always abort when --abort-on-uncaught-exception was passed.
921922 should_abort_on_uncaught_toggle_[0 ] = 1 ;
922923
924+ // The process is not exiting by default.
925+ set_exiting (false );
926+
923927 performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_ENVIRONMENT,
924928 time_origin_);
925929 performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_NODE_START,
@@ -1811,6 +1815,7 @@ EnvSerializeInfo Environment::Serialize(SnapshotCreator* creator) {
18111815 info.immediate_info = immediate_info_.Serialize (ctx, creator);
18121816 info.tick_info = tick_info_.Serialize (ctx, creator);
18131817 info.performance_state = performance_state_->Serialize (ctx, creator);
1818+ info.exiting = exiting_.Serialize (ctx, creator);
18141819 info.stream_base_state = stream_base_state_.Serialize (ctx, creator);
18151820 info.should_abort_on_uncaught_toggle =
18161821 should_abort_on_uncaught_toggle_.Serialize (ctx, creator);
@@ -1858,6 +1863,7 @@ std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& i) {
18581863 << " // -- performance_state begins --\n "
18591864 << i.performance_state << " ,\n "
18601865 << " // -- performance_state ends --\n "
1866+ << i.exiting << " , // exiting\n "
18611867 << i.stream_base_state << " , // stream_base_state\n "
18621868 << i.should_abort_on_uncaught_toggle
18631869 << " , // should_abort_on_uncaught_toggle\n "
@@ -1901,6 +1907,7 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
19011907 immediate_info_.Deserialize (ctx);
19021908 tick_info_.Deserialize (ctx);
19031909 performance_state_->Deserialize (ctx);
1910+ exiting_.Deserialize (ctx);
19041911 stream_base_state_.Deserialize (ctx);
19051912 should_abort_on_uncaught_toggle_.Deserialize (ctx);
19061913
@@ -2121,6 +2128,7 @@ void Environment::MemoryInfo(MemoryTracker* tracker) const {
21212128 native_modules_without_cache);
21222129 tracker->TrackField (" destroy_async_id_list" , destroy_async_id_list_);
21232130 tracker->TrackField (" exec_argv" , exec_argv_);
2131+ tracker->TrackField (" exiting" , exiting_);
21242132 tracker->TrackField (" should_abort_on_uncaught_toggle" ,
21252133 should_abort_on_uncaught_toggle_);
21262134 tracker->TrackField (" stream_base_state" , stream_base_state_);
0 commit comments