report: fix build warning in node_report.cc

Fixes `maybe-uninitialized` build warning in `src/node_report.cc`.

PR-URL: https://github.com/nodejs/node/pull/26265
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
Richard Lau 2019-02-22 13:22:06 -05:00
parent cd302d70dd
commit 4a10ce6883

View File

@ -172,16 +172,14 @@ std::string TriggerNodeReport(Isolate* isolate,
std::cerr << " (errno: " << errno << ")" << std::endl;
return "";
}
outstream = &outfile;
std::cerr << std::endl
<< "Writing Node.js report to file: " << filename << std::endl;
}
// Pass our stream about by reference, not by copying it.
std::ostream& out = outfile.is_open() ? outfile : *outstream;
WriteNodeReport(
isolate, env, message, location, filename, out, stackstr, &tm_struct);
WriteNodeReport(isolate, env, message, location, filename, *outstream,
stackstr, &tm_struct);
// Do not close stdout/stderr, only close files we opened.
if (outfile.is_open()) {