@@ -672,6 +672,7 @@ Environment::Environment(IsolateData* isolate_data,
672
672
exec_argv_(exec_args),
673
673
argv_(args),
674
674
exec_path_(GetExecPath(args)),
675
+ exiting_(isolate_, 1 , MAYBE_FIELD_PTR(env_info, exiting)),
675
676
should_abort_on_uncaught_toggle_(
676
677
isolate_,
677
678
1 ,
@@ -778,6 +779,9 @@ void Environment::InitializeMainContext(Local<Context> context,
778
779
// By default, always abort when --abort-on-uncaught-exception was passed.
779
780
should_abort_on_uncaught_toggle_[0 ] = 1 ;
780
781
782
+ // The process is not exiting by default.
783
+ set_exiting (false );
784
+
781
785
performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_ENVIRONMENT,
782
786
environment_start_time_);
783
787
performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_NODE_START,
@@ -1669,6 +1673,7 @@ EnvSerializeInfo Environment::Serialize(SnapshotCreator* creator) {
1669
1673
info.immediate_info = immediate_info_.Serialize (ctx, creator);
1670
1674
info.tick_info = tick_info_.Serialize (ctx, creator);
1671
1675
info.performance_state = performance_state_->Serialize (ctx, creator);
1676
+ info.exiting = exiting_.Serialize (ctx, creator);
1672
1677
info.stream_base_state = stream_base_state_.Serialize (ctx, creator);
1673
1678
info.should_abort_on_uncaught_toggle =
1674
1679
should_abort_on_uncaught_toggle_.Serialize (ctx, creator);
@@ -1716,6 +1721,7 @@ std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& i) {
1716
1721
<< " // -- performance_state begins --\n "
1717
1722
<< i.performance_state << " ,\n "
1718
1723
<< " // -- performance_state ends --\n "
1724
+ << i.exiting << " , // exiting\n "
1719
1725
<< i.stream_base_state << " , // stream_base_state\n "
1720
1726
<< i.should_abort_on_uncaught_toggle
1721
1727
<< " , // should_abort_on_uncaught_toggle\n "
@@ -1759,6 +1765,7 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
1759
1765
immediate_info_.Deserialize (ctx);
1760
1766
tick_info_.Deserialize (ctx);
1761
1767
performance_state_->Deserialize (ctx);
1768
+ exiting_.Deserialize (ctx);
1762
1769
stream_base_state_.Deserialize (ctx);
1763
1770
should_abort_on_uncaught_toggle_.Deserialize (ctx);
1764
1771
@@ -1979,6 +1986,7 @@ void Environment::MemoryInfo(MemoryTracker* tracker) const {
1979
1986
native_modules_without_cache);
1980
1987
tracker->TrackField (" destroy_async_id_list" , destroy_async_id_list_);
1981
1988
tracker->TrackField (" exec_argv" , exec_argv_);
1989
+ tracker->TrackField (" exiting" , exiting_);
1982
1990
tracker->TrackField (" should_abort_on_uncaught_toggle" ,
1983
1991
should_abort_on_uncaught_toggle_);
1984
1992
tracker->TrackField (" stream_base_state" , stream_base_state_);
0 commit comments