@@ -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,22 @@ 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,
931+ env,
932+ message,
933+ trigger,
934+ filename,
935+ *outstream,
936+ error,
937+ compact,
938+ disable_network);
922939
923940 // Do not close stdout/stderr, only close files we opened.
924941 if (outfile.is_open ()) {
@@ -969,8 +986,13 @@ void GetNodeReport(Isolate* isolate,
969986 if (isolate != nullptr ) {
970987 env = Environment::GetCurrent (isolate);
971988 }
989+ bool disable_network;
990+ {
991+ Mutex::ScopedLock lock (per_process::cli_options_mutex);
992+ disable_network = per_process::cli_options->report_disable_network ;
993+ }
972994 report::WriteNodeReport (
973- isolate, env, message, trigger, " " , out, error, false );
995+ isolate, env, message, trigger, " " , out, error, false , disable_network );
974996}
975997
976998// External function to trigger a report, writing to a supplied stream.
@@ -983,8 +1005,13 @@ void GetNodeReport(Environment* env,
9831005 if (env != nullptr ) {
9841006 isolate = env->isolate ();
9851007 }
1008+ bool disable_network;
1009+ {
1010+ Mutex::ScopedLock lock (per_process::cli_options_mutex);
1011+ disable_network = per_process::cli_options->report_disable_network ;
1012+ }
9861013 report::WriteNodeReport (
987- isolate, env, message, trigger, " " , out, error, false );
1014+ isolate, env, message, trigger, " " , out, error, false , disable_network );
9881015}
9891016
9901017} // namespace node
0 commit comments