@@ -672,6 +672,7 @@ Environment::Environment(IsolateData* isolate_data,
672672 exec_argv_(exec_args),
673673 argv_(args),
674674 exec_path_(GetExecPath(args)),
675+ exiting_(isolate_, 1 , MAYBE_FIELD_PTR(env_info, exiting)),
675676 should_abort_on_uncaught_toggle_(
676677 isolate_,
677678 1 ,
@@ -778,6 +779,9 @@ void Environment::InitializeMainContext(Local<Context> context,
778779 // By default, always abort when --abort-on-uncaught-exception was passed.
779780 should_abort_on_uncaught_toggle_[0 ] = 1 ;
780781
782+ // The process is not exiting by default.
783+ set_exiting (false );
784+
781785 performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_ENVIRONMENT,
782786 environment_start_time_);
783787 performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_NODE_START,
@@ -1669,6 +1673,7 @@ EnvSerializeInfo Environment::Serialize(SnapshotCreator* creator) {
16691673 info.immediate_info = immediate_info_.Serialize (ctx, creator);
16701674 info.tick_info = tick_info_.Serialize (ctx, creator);
16711675 info.performance_state = performance_state_->Serialize (ctx, creator);
1676+ info.exiting = exiting_.Serialize (ctx, creator);
16721677 info.stream_base_state = stream_base_state_.Serialize (ctx, creator);
16731678 info.should_abort_on_uncaught_toggle =
16741679 should_abort_on_uncaught_toggle_.Serialize (ctx, creator);
@@ -1716,6 +1721,7 @@ std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& i) {
17161721 << " // -- performance_state begins --\n "
17171722 << i.performance_state << " ,\n "
17181723 << " // -- performance_state ends --\n "
1724+ << i.exiting << " , // exiting\n "
17191725 << i.stream_base_state << " , // stream_base_state\n "
17201726 << i.should_abort_on_uncaught_toggle
17211727 << " , // should_abort_on_uncaught_toggle\n "
@@ -1759,6 +1765,7 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
17591765 immediate_info_.Deserialize (ctx);
17601766 tick_info_.Deserialize (ctx);
17611767 performance_state_->Deserialize (ctx);
1768+ exiting_.Deserialize (ctx);
17621769 stream_base_state_.Deserialize (ctx);
17631770 should_abort_on_uncaught_toggle_.Deserialize (ctx);
17641771
@@ -1979,6 +1986,7 @@ void Environment::MemoryInfo(MemoryTracker* tracker) const {
19791986 native_modules_without_cache);
19801987 tracker->TrackField (" destroy_async_id_list" , destroy_async_id_list_);
19811988 tracker->TrackField (" exec_argv" , exec_argv_);
1989+ tracker->TrackField (" exiting" , exiting_);
19821990 tracker->TrackField (" should_abort_on_uncaught_toggle" ,
19831991 should_abort_on_uncaught_toggle_);
19841992 tracker->TrackField (" stream_base_state" , stream_base_state_);
0 commit comments