diff options
| author | Tim Blechmann | 2022-09-10 12:18:19 +0800 |
|---|---|---|
| committer | Martin Hořeňovský | 2022-09-11 23:49:15 +0200 |
| commit | 359542d53ec142514da8a606ada8d9efd13b9678 (patch) | |
| tree | 56c2d65ae3bf91b02d2a04558bf5f86545b351fa | |
| parent | dea1a6abd92b5892956fa474540ab4424a8ca1c3 (diff) | |
| download | catch3-359542d53ec142514da8a606ada8d9efd13b9678.tar.gz | |
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
| -rw-r--r-- | src/catch2/internal/catch_istream.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_istream.cpp b/src/catch2/internal/catch_istream.cpp index 4cd35058..6d1fa94b 100644 --- a/src/catch2/internal/catch_istream.cpp +++ b/src/catch2/internal/catch_istream.cpp @@ -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 |