@@ -61,7 +61,8 @@ static void WriteNodeReport(Isolate* isolate,
61
61
std::ostream& out,
62
62
Local<Value> error,
63
63
bool compact,
64
- bool exclude_network = false );
64
+ bool exclude_network = false ,
65
+ bool exclude_env = false );
65
66
static void PrintVersionInformation (JSONWriter* writer,
66
67
bool exclude_network = false );
67
68
static void PrintJavaScriptErrorStack (JSONWriter* writer,
@@ -96,7 +97,8 @@ static void WriteNodeReport(Isolate* isolate,
96
97
std::ostream& out,
97
98
Local<Value> error,
98
99
bool compact,
99
- bool exclude_network) {
100
+ bool exclude_network,
101
+ bool exclude_env) {
100
102
// Obtain the current time and the pid.
101
103
TIME_TYPE tm_struct;
102
104
DiagnosticFilename::LocalTime (&tm_struct);
@@ -250,7 +252,7 @@ static void WriteNodeReport(Isolate* isolate,
250
252
writer.json_arrayend ();
251
253
252
254
// Report operating system information
253
- if (env-> ShouldPreserveEnvOnReport () ) {
255
+ if (exclude_env == false ) {
254
256
PrintEnvironmentVariables (&writer);
255
257
}
256
258
PrintSystemInformation (&writer);
@@ -921,6 +923,10 @@ std::string TriggerNodeReport(Isolate* isolate,
921
923
bool exclude_network = env != nullptr ? env->options ()->report_exclude_network
922
924
: per_process::cli_options->per_isolate
923
925
->per_env ->report_exclude_network ;
926
+ bool exclude_env =
927
+ env != nullptr
928
+ ? env->report_exclude_env ()
929
+ : per_process::cli_options->per_isolate ->per_env ->report_exclude_env ;
924
930
925
931
report::WriteNodeReport (isolate,
926
932
env,
@@ -930,7 +936,8 @@ std::string TriggerNodeReport(Isolate* isolate,
930
936
*outstream,
931
937
error,
932
938
compact,
933
- exclude_network);
939
+ exclude_network,
940
+ exclude_env);
934
941
935
942
// Do not close stdout/stderr, only close files we opened.
936
943
if (outfile.is_open ()) {
@@ -984,8 +991,20 @@ void GetNodeReport(Isolate* isolate,
984
991
bool exclude_network = env != nullptr ? env->options ()->report_exclude_network
985
992
: per_process::cli_options->per_isolate
986
993
->per_env ->report_exclude_network ;
987
- report::WriteNodeReport (
988
- isolate, env, message, trigger, " " , out, error, false , exclude_network);
994
+ bool exclude_env =
995
+ env != nullptr
996
+ ? env->report_exclude_env ()
997
+ : per_process::cli_options->per_isolate ->per_env ->report_exclude_env ;
998
+ report::WriteNodeReport (isolate,
999
+ env,
1000
+ message,
1001
+ trigger,
1002
+ " " ,
1003
+ out,
1004
+ error,
1005
+ false ,
1006
+ exclude_network,
1007
+ exclude_env);
989
1008
}
990
1009
991
1010
// External function to trigger a report, writing to a supplied stream.
@@ -1001,8 +1020,20 @@ void GetNodeReport(Environment* env,
1001
1020
bool exclude_network = env != nullptr ? env->options ()->report_exclude_network
1002
1021
: per_process::cli_options->per_isolate
1003
1022
->per_env ->report_exclude_network ;
1004
- report::WriteNodeReport (
1005
- isolate, env, message, trigger, " " , out, error, false , exclude_network);
1023
+ bool exclude_env =
1024
+ env != nullptr
1025
+ ? env->report_exclude_env ()
1026
+ : per_process::cli_options->per_isolate ->per_env ->report_exclude_env ;
1027
+ report::WriteNodeReport (isolate,
1028
+ env,
1029
+ message,
1030
+ trigger,
1031
+ " " ,
1032
+ out,
1033
+ error,
1034
+ false ,
1035
+ exclude_network,
1036
+ exclude_env);
1006
1037
}
1007
1038
1008
1039
} // namespace node
0 commit comments