FileStream: enable automatic flushing

when a test executable is killed by a signal (e.g. when executed by
ctest with timeout), the reporter files are not flushed. this can lead
to incomplete (or empty) report files.
to avoid this we enable automatic flushing via `std::unitbuf`

compare #663
This commit is contained in:
Tim Blechmann 2022-09-10 12:18:19 +08:00 committed by Martin Hořeňovský
parent dea1a6abd9
commit 359542d53e
1 changed files with 1 additions and 0 deletions

View File

@ -78,6 +78,7 @@ namespace Detail {
FileStream( std::string const& filename ) {
m_ofs.open( filename.c_str() );
CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' );
m_ofs << std::unitbuf;
}
~FileStream() override = default;
public: // IStream