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 #663
  • Loading branch information
timblechmann committed Sep 10, 2022
1 parent dea1a6a commit 7913602
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/catch2/internal/catch_istream.cpp
Original file line number Diff line number Diff line change
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 7913602

Please sign in to comment.