Flush stderr before printing to stdout

It's necessary to flush stderr before printing to stdout in adition to
flushing stdout before printing to stderr, to make sure all output is
ordered correctly.
This commit is contained in:
Josiah VanderZee 2024-05-17 14:57:30 -05:00
parent ca092a85fd
commit 26f0187987
1 changed files with 5 additions and 4 deletions

View File

@ -239,10 +239,11 @@ bool run_tests()
}
rawstream << "Catch test results: " << std::endl;
// Catch prints out the results of this invocation.
// Catch prints to stdout, whereas rawstream prints to
// stderr. We have to flush stdout manually to make sure
// they show up in the right order in the output.
// Catch prints out the results of this invocation
// to stdout, whereas rawstream prints to stderr.
// We must flush the streams so they are ordered
// correctly in the output.
std::cerr.flush();
auto num_catch_tests_failed = Catch::Session().run();
std::cout.flush();
// We count the all the Catch tests as one test for Minetest's own logging