[Boost-bugs] [Boost C++ Libraries] #6576: boost:::iostreams::file_descriptor throws instead of reading EOF on pipe

Subject: [Boost-bugs] [Boost C++ Libraries] #6576: boost:::iostreams::file_descriptor throws instead of reading EOF on pipe
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-18 16:34:28


#6576: boost:::iostreams::file_descriptor throws instead of reading EOF on pipe
-------------------------------------------+--------------------------------
 Reporter: maihem@… | Owner: turkanis
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: iostreams
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: pipe read ReadFile CreatePipe |
-------------------------------------------+--------------------------------
 when using file_descriptor to read from a pipe on windows, an exception
 can be thrown if the write-side has broken the pipe - eg by exiting if
 it's another process.

 This is how I used the read-side of the pipe to trigger the failure (if
 you need a complete minimal sample including windows pipe and process
 handling code, please ask). I just used CreateProcess to start a cmd.exe
 shell script that echo'd a couple of lines to stdout. The pipe has less
 than the default buffer size written before the write side is closed:

 file_descriptor fd(pipe_read_side_handle);
 newline_filter nl(newline::posix);
 filtered_istream fs;
 fs.push(nl);
 fs.push(fd);
 string str;
 getline(fs, str);

 // fs.good() is now false

 // expected: fs.good() should be true here
 getline(fs, str);
 getline(fs, str);
 //...
 // eventually fs.eof() should be true
 getline(fs, str); // one more getline
 // then fs.fail() should be true.
 // I think there are a few different behaviours depending on
 // whether there is a trailing newline or not
 // but I think fs.badbit should not be set

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6576>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC