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 authored and Martin Hořeňovský committed 2022-09-11 23:49:15 +02:00
1 parent dea1a6abd9
commit 359542d53e
1 file changed
+1
+1
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