Skip to content

Commit

Permalink
FileStream: enable automatic flushing
Browse files Browse the repository at this point in the history
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 catchorg#663
  • Loading branch information
timblechmann authored and horenmar committed Sep 11, 2022
1 parent dea1a6a commit 359542d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/catch2/internal/catch_istream.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 359542d

Please sign in to comment.