From 770376bd6ed4a8d03d2dcacb3252c5be07420f65 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Sun, 17 Jul 2022 19:56:56 -0700 Subject: [PATCH] Print the result to stdout even when trace_file is set. (#1406) --- explorer/main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/explorer/main.cpp b/explorer/main.cpp index f159a14e617f..745aefa6e781 100644 --- a/explorer/main.cpp +++ b/explorer/main.cpp @@ -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(); }