CMake execute_process flush
CMake execute_process doesn’t print to console stdout until the process ends or flushes the stdout buffer. Likewise, CTest runs don’t print to console stdout until the process ends or flushes the stdout buffer. This means if a program exits abnormally, the output will not be printed by CMake or CTest unless the buffer was flushed.
This is shown by
example.
C++ <ostream>
std::endl inserts a newline into the buffer and flushes it.
The stdout print before flush behavior may be platform-dependent in general for programs.
We observed that CMake and CTest didn’t print till flushed.