@@ -61,8 +61,9 @@ static void WriteNodeReport(Isolate* isolate,
6161 const std::string& filename,
6262 std::ostream& out,
6363 Local<Value> error,
64- bool compact);
65- static void PrintVersionInformation (JSONWriter* writer);
64+ bool compact,
65+ bool disable_network);
66+ static void PrintVersionInformation (JSONWriter* writer, bool disable_network);
6667static void PrintJavaScriptErrorStack (JSONWriter* writer,
6768 Isolate* isolate,
6869 Local<Value> error,
@@ -93,7 +94,8 @@ static void WriteNodeReport(Isolate* isolate,
9394 const std::string& filename,
9495 std::ostream& out,
9596 Local<Value> error,
96- bool compact) {
97+ bool compact,
98+ bool disable_network) {
9799 // Obtain the current time and the pid.
98100 TIME_TYPE tm_struct;
99101 DiagnosticFilename::LocalTime (&tm_struct);
@@ -174,7 +176,7 @@ static void WriteNodeReport(Isolate* isolate,
174176 }
175177
176178 // Report Node.js and OS version information
177- PrintVersionInformation (&writer);
179+ PrintVersionInformation (&writer, disable_network );
178180 writer.json_objectend ();
179181
180182 if (isolate != nullptr ) {
@@ -256,7 +258,7 @@ static void WriteNodeReport(Isolate* isolate,
256258}
257259
258260// Report Node.js version, OS version and machine information.
259- static void PrintVersionInformation (JSONWriter* writer) {
261+ static void PrintVersionInformation (JSONWriter* writer, bool disable_network ) {
260262 std::ostringstream buf;
261263 // Report Node version
262264 buf << " v" << NODE_VERSION_STRING;
@@ -300,7 +302,8 @@ static void PrintVersionInformation(JSONWriter* writer) {
300302 }
301303
302304 PrintCpuInfo (writer);
303- PrintNetworkInterfaceInfo (writer);
305+ if (!disable_network)
306+ PrintNetworkInterfaceInfo (writer);
304307
305308 char host[UV_MAXHOSTNAMESIZE];
306309 size_t host_size = sizeof (host);
@@ -917,8 +920,14 @@ std::string TriggerNodeReport(Isolate* isolate,
917920 compact = per_process::cli_options->report_compact ;
918921 }
919922
923+ bool disable_network;
924+ {
925+ Mutex::ScopedLock lock (per_process::cli_options_mutex);
926+ disable_network = per_process::cli_options->report_disable_network ;
927+ }
928+
920929 report::WriteNodeReport (
921- isolate, env, message, trigger, filename, *outstream, error, compact);
930+ isolate, env, message, trigger, filename, *outstream, error, compact, disable_network );
922931
923932 // Do not close stdout/stderr, only close files we opened.
924933 if (outfile.is_open ()) {
@@ -969,8 +978,13 @@ void GetNodeReport(Isolate* isolate,
969978 if (isolate != nullptr ) {
970979 env = Environment::GetCurrent (isolate);
971980 }
981+ bool disable_network;
982+ {
983+ Mutex::ScopedLock lock (per_process::cli_options_mutex);
984+ disable_network = per_process::cli_options->report_disable_network ;
985+ }
972986 report::WriteNodeReport (
973- isolate, env, message, trigger, " " , out, error, false );
987+ isolate, env, message, trigger, " " , out, error, false , disable_network );
974988}
975989
976990// External function to trigger a report, writing to a supplied stream.
@@ -983,8 +997,13 @@ void GetNodeReport(Environment* env,
983997 if (env != nullptr ) {
984998 isolate = env->isolate ();
985999 }
1000+ bool disable_network;
1001+ {
1002+ Mutex::ScopedLock lock (per_process::cli_options_mutex);
1003+ disable_network = per_process::cli_options->report_disable_network ;
1004+ }
9861005 report::WriteNodeReport (
987- isolate, env, message, trigger, " " , out, error, false );
1006+ isolate, env, message, trigger, " " , out, error, false , disable_network );
9881007}
9891008
9901009} // namespace node
0 commit comments