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