Print the result to stdout even when trace_file is set. (#1406)

This commit is contained in:
Jon Ross-Perkins
2022-07-17 22:56:56 -04:00
committed by GitHub
parent dab4f56e4e
commit 770376bd6e
+6 -3
View File
@@ -77,9 +77,12 @@ static auto Main(llvm::StringRef default_prelude_file, int argc, char* argv[])
// Typecheck and run the parsed program.
CARBON_ASSIGN_OR_RETURN(int return_code,
ExecProgram(&arena, ast, trace_stream));
// Print the return code to stdout even when we aren't tracing.
(trace_stream ? **trace_stream : llvm::outs())
<< "result: " << return_code << "\n";
// Always print the return code to stdout.
llvm::outs() << "result: " << return_code << "\n";
// When there's a dedicated trace file, print the return code to it too.
if (scoped_trace_stream) {
**trace_stream << "result: " << return_code << "\n";
}
return Success();
}