@@ -95,6 +95,17 @@ static void SetExcludeNetwork(const FunctionCallbackInfo<Value>& info) {
9595 env->options ()->report_exclude_network = info[0 ]->IsTrue ();
9696}
9797
98+ static void GetExcludeEnv (const FunctionCallbackInfo<Value>& info) {
99+ Environment* env = Environment::GetCurrent (info);
100+ info.GetReturnValue ().Set (env->report_exclude_env ());
101+ }
102+
103+ static void SetExcludeEnv (const FunctionCallbackInfo<Value>& info) {
104+ Environment* env = Environment::GetCurrent (info);
105+ CHECK (info[0 ]->IsBoolean ());
106+ env->options ()->report_exclude_env = info[0 ]->IsTrue ();
107+ }
108+
98109static void GetDirectory (const FunctionCallbackInfo<Value>& info) {
99110 Mutex::ScopedLock lock (per_process::cli_options_mutex);
100111 Environment* env = Environment::GetCurrent (info);
@@ -170,12 +181,6 @@ static void ShouldReportOnUncaughtException(
170181 env->isolate_data ()->options ()->report_uncaught_exception );
171182}
172183
173- static void ShouldExcludeEnvironmentVariables (
174- const FunctionCallbackInfo<Value>& info) {
175- Environment* env = Environment::GetCurrent (info);
176- info.GetReturnValue ().Set (env->report_exclude_env ());
177- }
178-
179184static void SetReportOnUncaughtException (
180185 const FunctionCallbackInfo<Value>& info) {
181186 Environment* env = Environment::GetCurrent (info);
@@ -193,6 +198,8 @@ static void Initialize(Local<Object> exports,
193198 SetMethod (context, exports, " setCompact" , SetCompact);
194199 SetMethod (context, exports, " getExcludeNetwork" , GetExcludeNetwork);
195200 SetMethod (context, exports, " setExcludeNetwork" , SetExcludeNetwork);
201+ SetMethod (context, exports, " getExcludeEnv" , GetExcludeEnv);
202+ SetMethod (context, exports, " setExcludeEnv" , SetExcludeEnv);
196203 SetMethod (context, exports, " getDirectory" , GetDirectory);
197204 SetMethod (context, exports, " setDirectory" , SetDirectory);
198205 SetMethod (context, exports, " getFilename" , GetFilename);
@@ -208,10 +215,6 @@ static void Initialize(Local<Object> exports,
208215 exports,
209216 " shouldReportOnUncaughtException" ,
210217 ShouldReportOnUncaughtException);
211- SetMethod (context,
212- exports,
213- " shouldExcludeEnvironmentVariables" ,
214- ShouldExcludeEnvironmentVariables);
215218 SetMethod (context,
216219 exports,
217220 " setReportOnUncaughtException" ,
@@ -225,6 +228,8 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
225228 registry->Register (SetCompact);
226229 registry->Register (GetExcludeNetwork);
227230 registry->Register (SetExcludeNetwork);
231+ registry->Register (GetExcludeEnv);
232+ registry->Register (SetExcludeEnv);
228233 registry->Register (GetDirectory);
229234 registry->Register (SetDirectory);
230235 registry->Register (GetFilename);
@@ -236,7 +241,6 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
236241 registry->Register (ShouldReportOnSignal);
237242 registry->Register (SetReportOnSignal);
238243 registry->Register (ShouldReportOnUncaughtException);
239- registry->Register (ShouldExcludeEnvironmentVariables);
240244 registry->Register (SetReportOnUncaughtException);
241245}
242246
0 commit comments