@@ -734,6 +734,7 @@ Environment::Environment(IsolateData* isolate_data,
734734 exec_argv_(exec_args),
735735 argv_(args),
736736 exec_path_(GetExecPath(args)),
737+ exiting_(isolate_, 1 , MAYBE_FIELD_PTR(env_info, exiting)),
737738 should_abort_on_uncaught_toggle_(
738739 isolate_,
739740 1 ,
@@ -840,6 +841,9 @@ void Environment::InitializeMainContext(Local<Context> context,
840841 // By default, always abort when --abort-on-uncaught-exception was passed.
841842 should_abort_on_uncaught_toggle_[0 ] = 1 ;
842843
844+ // The process is not exiting by default.
845+ set_exiting (false );
846+
843847 performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_ENVIRONMENT,
844848 environment_start_time_);
845849 performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_NODE_START,
@@ -1741,6 +1745,7 @@ EnvSerializeInfo Environment::Serialize(SnapshotCreator* creator) {
17411745 info.immediate_info = immediate_info_.Serialize (ctx, creator);
17421746 info.tick_info = tick_info_.Serialize (ctx, creator);
17431747 info.performance_state = performance_state_->Serialize (ctx, creator);
1748+ info.exiting = exiting_.Serialize (ctx, creator);
17441749 info.stream_base_state = stream_base_state_.Serialize (ctx, creator);
17451750 info.should_abort_on_uncaught_toggle =
17461751 should_abort_on_uncaught_toggle_.Serialize (ctx, creator);
@@ -1812,6 +1817,7 @@ std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& i) {
18121817 << " // -- performance_state begins --\n "
18131818 << i.performance_state << " ,\n "
18141819 << " // -- performance_state ends --\n "
1820+ << i.exiting << " , // exiting\n "
18151821 << i.stream_base_state << " , // stream_base_state\n "
18161822 << i.should_abort_on_uncaught_toggle
18171823 << " , // should_abort_on_uncaught_toggle\n "
@@ -1858,6 +1864,7 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
18581864 immediate_info_.Deserialize (ctx);
18591865 tick_info_.Deserialize (ctx);
18601866 performance_state_->Deserialize (ctx);
1867+ exiting_.Deserialize (ctx);
18611868 stream_base_state_.Deserialize (ctx);
18621869 should_abort_on_uncaught_toggle_.Deserialize (ctx);
18631870
@@ -2088,6 +2095,7 @@ void Environment::MemoryInfo(MemoryTracker* tracker) const {
20882095 native_modules_without_cache);
20892096 tracker->TrackField (" destroy_async_id_list" , destroy_async_id_list_);
20902097 tracker->TrackField (" exec_argv" , exec_argv_);
2098+ tracker->TrackField (" exiting" , exiting_);
20912099 tracker->TrackField (" should_abort_on_uncaught_toggle" ,
20922100 should_abort_on_uncaught_toggle_);
20932101 tracker->TrackField (" stream_base_state" , stream_base_state_);
0 commit comments