@@ -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,
@@ -78,6 +79,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer,
78
79
static void PrintNativeStack (JSONWriter* writer);
79
80
static void PrintResourceUsage (JSONWriter* writer);
80
81
static void PrintGCStatistics (JSONWriter* writer, Isolate* isolate);
82
+ static void PrintEnvironmentVariables (JSONWriter* writer);
81
83
static void PrintSystemInformation (JSONWriter* writer);
82
84
static void PrintLoadedLibraries (JSONWriter* writer);
83
85
static void PrintComponentVersions (JSONWriter* writer);
@@ -95,7 +97,8 @@ static void WriteNodeReport(Isolate* isolate,
95
97
std::ostream& out,
96
98
Local<Value> error,
97
99
bool compact,
98
- bool exclude_network) {
100
+ bool exclude_network,
101
+ bool exclude_env) {
99
102
// Obtain the current time and the pid.
100
103
TIME_TYPE tm_struct;
101
104
DiagnosticFilename::LocalTime (&tm_struct);
@@ -251,6 +254,9 @@ static void WriteNodeReport(Isolate* isolate,
251
254
writer.json_arrayend ();
252
255
253
256
// Report operating system information
257
+ if (exclude_env == false ) {
258
+ PrintEnvironmentVariables (&writer);
259
+ }
254
260
PrintSystemInformation (&writer);
255
261
256
262
writer.json_objectend ();
@@ -696,8 +702,7 @@ static void PrintResourceUsage(JSONWriter* writer) {
696
702
#endif // RUSAGE_THREAD
697
703
}
698
704
699
- // Report operating system information.
700
- static void PrintSystemInformation (JSONWriter* writer) {
705
+ static void PrintEnvironmentVariables (JSONWriter* writer) {
701
706
uv_env_item_t * envitems;
702
707
int envcount;
703
708
int r;
@@ -717,7 +722,10 @@ static void PrintSystemInformation(JSONWriter* writer) {
717
722
}
718
723
719
724
writer->json_objectend ();
725
+ }
720
726
727
+ // Report operating system information.
728
+ static void PrintSystemInformation (JSONWriter* writer) {
721
729
#ifndef _WIN32
722
730
static struct {
723
731
const char * description;
@@ -917,6 +925,10 @@ std::string TriggerNodeReport(Isolate* isolate,
917
925
bool exclude_network = env != nullptr ? env->options ()->report_exclude_network
918
926
: per_process::cli_options->per_isolate
919
927
->per_env ->report_exclude_network ;
928
+ bool exclude_env =
929
+ env != nullptr
930
+ ? env->report_exclude_env ()
931
+ : per_process::cli_options->per_isolate ->per_env ->report_exclude_env ;
920
932
921
933
report::WriteNodeReport (isolate,
922
934
env,
@@ -926,7 +938,8 @@ std::string TriggerNodeReport(Isolate* isolate,
926
938
*outstream,
927
939
error,
928
940
compact,
929
- exclude_network);
941
+ exclude_network,
942
+ exclude_env);
930
943
931
944
// Do not close stdout/stderr, only close files we opened.
932
945
if (outfile.is_open ()) {
@@ -980,8 +993,20 @@ void GetNodeReport(Isolate* isolate,
980
993
bool exclude_network = env != nullptr ? env->options ()->report_exclude_network
981
994
: per_process::cli_options->per_isolate
982
995
->per_env ->report_exclude_network ;
983
- report::WriteNodeReport (
984
- isolate, env, message, trigger, " " , out, error, false , exclude_network);
996
+ bool exclude_env =
997
+ env != nullptr
998
+ ? env->report_exclude_env ()
999
+ : per_process::cli_options->per_isolate ->per_env ->report_exclude_env ;
1000
+ report::WriteNodeReport (isolate,
1001
+ env,
1002
+ message,
1003
+ trigger,
1004
+ " " ,
1005
+ out,
1006
+ error,
1007
+ false ,
1008
+ exclude_network,
1009
+ exclude_env);
985
1010
}
986
1011
987
1012
// External function to trigger a report, writing to a supplied stream.
@@ -997,8 +1022,20 @@ void GetNodeReport(Environment* env,
997
1022
bool exclude_network = env != nullptr ? env->options ()->report_exclude_network
998
1023
: per_process::cli_options->per_isolate
999
1024
->per_env ->report_exclude_network ;
1000
- report::WriteNodeReport (
1001
- isolate, env, message, trigger, " " , out, error, false , exclude_network);
1025
+ bool exclude_env =
1026
+ env != nullptr
1027
+ ? env->report_exclude_env ()
1028
+ : per_process::cli_options->per_isolate ->per_env ->report_exclude_env ;
1029
+ report::WriteNodeReport (isolate,
1030
+ env,
1031
+ message,
1032
+ trigger,
1033
+ " " ,
1034
+ out,
1035
+ error,
1036
+ false ,
1037
+ exclude_network,
1038
+ exclude_env);
1002
1039
}
1003
1040
1004
1041
} // namespace node
0 commit comments