mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	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:
		
				
					committed by
					
						
						Martin Hořeňovský
					
				
			
			
				
	
			
			
			
						parent
						
							dea1a6abd9
						
					
				
				
					commit
					359542d53e
				
			@@ -78,6 +78,7 @@ namespace Detail {
 | 
				
			|||||||
            FileStream( std::string const& filename ) {
 | 
					            FileStream( std::string const& filename ) {
 | 
				
			||||||
                m_ofs.open( filename.c_str() );
 | 
					                m_ofs.open( filename.c_str() );
 | 
				
			||||||
                CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' );
 | 
					                CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' );
 | 
				
			||||||
 | 
					                m_ofs << std::unitbuf;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            ~FileStream() override = default;
 | 
					            ~FileStream() override = default;
 | 
				
			||||||
        public: // IStream
 | 
					        public: // IStream
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user