google / benchmark

A microbenchmark support library
Apache License 2.0
8.59k stars 1.57k forks source link

[BUG] Result of run with --benchmark_list_tests=true may not show on console #1734

Closed bstordrup closed 5 months ago

bstordrup commented 5 months ago

Describe the bug If I have a setup that creates a console using AllocConsole or attaches to a console with AttachConsole, the result of running with --benchmark_list_tests=true are not shown in the console because the streams are not flushed.

System Which OS, compiler, and compiler version are you using:

To reproduce Steps to reproduce the behavior:

  1. In a non-console project, call AllocConsole
  2. Create std::ostream instances for the STD_OUTPUT_HANDLE and STD_ERR_HANDLE
  3. Create a benchmarker::ConsoleReporter
  4. Call SetOutputStream and SetErrorStream
  5. Run benchmarks with --benchmark_list_tests=true
  6. Note that the benchmark list is not shown in console.

Expected behavior The list of benchmarks should be listed in console.