Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79919 - trunk/libs/iostreams/src
From: marshall_at_[hidden]
Date: 2012-08-07 22:24:03


Author: marshall
Date: 2012-08-07 22:24:03 EDT (Tue, 07 Aug 2012)
New Revision: 79919
URL: http://svn.boost.org/trac/boost/changeset/79919

Log:
Fix throwing error; Refs #6576
Text files modified:
   trunk/libs/iostreams/src/file_descriptor.cpp | 10 +++++++++-
   1 files changed, 9 insertions(+), 1 deletions(-)

Modified: trunk/libs/iostreams/src/file_descriptor.cpp
==============================================================================
--- trunk/libs/iostreams/src/file_descriptor.cpp (original)
+++ trunk/libs/iostreams/src/file_descriptor.cpp 2012-08-07 22:24:03 EDT (Tue, 07 Aug 2012)
@@ -263,7 +263,15 @@
 #ifdef BOOST_IOSTREAMS_WINDOWS
     DWORD result;
     if (!::ReadFile(handle_, s, n, &result, NULL))
- throw_system_failure("failed reading");
+ {
+ // report EOF if the write-side of a pipe has been closed
+ if (GetLastError() == ERROR_BROKEN_PIPE)
+ {
+ result = 0;
+ }
+ else
+ throw_system_failure("failed reading");
+ }
     return result == 0 ? -1 : static_cast<std::streamsize>(result);
 #else // #ifdef BOOST_IOSTREAMS_WINDOWS
     errno = 0;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk