Skip to content

Commit fc0a86b

Browse files
committed
Do not close stdin,stdout,stderr on exit
1 parent bbaa9d2 commit fc0a86b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ofstream.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ ofstream::ofstream (const char* filename, openmode mode)
5050
ofstream::~ofstream (void) noexcept
5151
{
5252
try { flush(); } catch (...) {}
53+
if (m_File.fd() <= STDERR_FILENO) // Do not close cin,cout,cerr
54+
m_File.detach();
5355
}
5456

5557
/// Flushes the buffer and closes the file.

0 commit comments

Comments
 (0)