@@ -813,6 +813,7 @@ Environment::Environment(IsolateData* isolate_data,
813
813
exec_argv_(exec_args),
814
814
argv_(args),
815
815
exec_path_(GetExecPath(args)),
816
+ exiting_(isolate_, 1 , MAYBE_FIELD_PTR(env_info, exiting)),
816
817
should_abort_on_uncaught_toggle_(
817
818
isolate_,
818
819
1 ,
@@ -919,6 +920,9 @@ void Environment::InitializeMainContext(Local<Context> context,
919
920
// By default, always abort when --abort-on-uncaught-exception was passed.
920
921
should_abort_on_uncaught_toggle_[0 ] = 1 ;
921
922
923
+ // The process is not exiting by default.
924
+ set_exiting (false );
925
+
922
926
performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_ENVIRONMENT,
923
927
environment_start_time_);
924
928
performance_state_->Mark (performance::NODE_PERFORMANCE_MILESTONE_NODE_START,
@@ -1810,6 +1814,7 @@ EnvSerializeInfo Environment::Serialize(SnapshotCreator* creator) {
1810
1814
info.immediate_info = immediate_info_.Serialize (ctx, creator);
1811
1815
info.tick_info = tick_info_.Serialize (ctx, creator);
1812
1816
info.performance_state = performance_state_->Serialize (ctx, creator);
1817
+ info.exiting = exiting_.Serialize (ctx, creator);
1813
1818
info.stream_base_state = stream_base_state_.Serialize (ctx, creator);
1814
1819
info.should_abort_on_uncaught_toggle =
1815
1820
should_abort_on_uncaught_toggle_.Serialize (ctx, creator);
@@ -1857,6 +1862,7 @@ std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& i) {
1857
1862
<< " // -- performance_state begins --\n "
1858
1863
<< i.performance_state << " ,\n "
1859
1864
<< " // -- performance_state ends --\n "
1865
+ << i.exiting << " , // exiting\n "
1860
1866
<< i.stream_base_state << " , // stream_base_state\n "
1861
1867
<< i.should_abort_on_uncaught_toggle
1862
1868
<< " , // should_abort_on_uncaught_toggle\n "
@@ -1900,6 +1906,7 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
1900
1906
immediate_info_.Deserialize (ctx);
1901
1907
tick_info_.Deserialize (ctx);
1902
1908
performance_state_->Deserialize (ctx);
1909
+ exiting_.Deserialize (ctx);
1903
1910
stream_base_state_.Deserialize (ctx);
1904
1911
should_abort_on_uncaught_toggle_.Deserialize (ctx);
1905
1912
@@ -2120,6 +2127,7 @@ void Environment::MemoryInfo(MemoryTracker* tracker) const {
2120
2127
native_modules_without_cache);
2121
2128
tracker->TrackField (" destroy_async_id_list" , destroy_async_id_list_);
2122
2129
tracker->TrackField (" exec_argv" , exec_argv_);
2130
+ tracker->TrackField (" exiting" , exiting_);
2123
2131
tracker->TrackField (" should_abort_on_uncaught_toggle" ,
2124
2132
should_abort_on_uncaught_toggle_);
2125
2133
tracker->TrackField (" stream_base_state" , stream_base_state_);
0 commit comments