@@ -734,6 +734,7 @@ Environment::Environment(IsolateData* isolate_data,
734
734
exec_argv_(exec_args),
735
735
argv_(args),
736
736
exec_path_(GetExecPath(args)),
737
+ exiting_(isolate_, 1 , MAYBE_FIELD_PTR(env_info, exiting)),
737
738
should_abort_on_uncaught_toggle_(
738
739
isolate_,
739
740
1 ,
@@ -840,6 +841,9 @@ void Environment::InitializeMainContext(Local<Context> context,
840
841
// By default, always abort when --abort-on-uncaught-exception was passed.
841
842
should_abort_on_uncaught_toggle_[0 ] = 1 ;
842
843
844
+ // The process is not exiting by default.
845
+ set_exiting (false );
846
+
843
847
performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_ENVIRONMENT,
844
848
environment_start_time_);
845
849
performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_NODE_START,
@@ -1741,6 +1745,7 @@ EnvSerializeInfo Environment::Serialize(SnapshotCreator* creator) {
1741
1745
info.immediate_info = immediate_info_.Serialize (ctx, creator);
1742
1746
info.tick_info = tick_info_.Serialize (ctx, creator);
1743
1747
info.performance_state = performance_state_->Serialize (ctx, creator);
1748
+ info.exiting = exiting_.Serialize (ctx, creator);
1744
1749
info.stream_base_state = stream_base_state_.Serialize (ctx, creator);
1745
1750
info.should_abort_on_uncaught_toggle =
1746
1751
should_abort_on_uncaught_toggle_.Serialize (ctx, creator);
@@ -1812,6 +1817,7 @@ std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& i) {
1812
1817
<< " // -- performance_state begins --\n "
1813
1818
<< i.performance_state << " ,\n "
1814
1819
<< " // -- performance_state ends --\n "
1820
+ << i.exiting << " , // exiting\n "
1815
1821
<< i.stream_base_state << " , // stream_base_state\n "
1816
1822
<< i.should_abort_on_uncaught_toggle
1817
1823
<< " , // should_abort_on_uncaught_toggle\n "
@@ -1858,6 +1864,7 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
1858
1864
immediate_info_.Deserialize (ctx);
1859
1865
tick_info_.Deserialize (ctx);
1860
1866
performance_state_->Deserialize (ctx);
1867
+ exiting_.Deserialize (ctx);
1861
1868
stream_base_state_.Deserialize (ctx);
1862
1869
should_abort_on_uncaught_toggle_.Deserialize (ctx);
1863
1870
@@ -2088,6 +2095,7 @@ void Environment::MemoryInfo(MemoryTracker* tracker) const {
2088
2095
native_modules_without_cache);
2089
2096
tracker->TrackField (" destroy_async_id_list" , destroy_async_id_list_);
2090
2097
tracker->TrackField (" exec_argv" , exec_argv_);
2098
+ tracker->TrackField (" exiting" , exiting_);
2091
2099
tracker->TrackField (" should_abort_on_uncaught_toggle" ,
2092
2100
should_abort_on_uncaught_toggle_);
2093
2101
tracker->TrackField (" stream_base_state" , stream_base_state_);
0 commit comments