Boost logo

Boost :

Subject: Re: [boost] How to bind program termination with end-of-stream in Boost.Process 0.5?
From: alfC (alfredo.correa_at_[hidden])
Date: 2012-09-15 23:29:29

On Sat, Sep 15, 2012 at 5:05 PM, Boris Schaeling [via Boost]
<ml-node+s2283326n4635818h36_at_[hidden]> wrote:
> On Sat, 15 Sep 2012 21:36:53 +0200, alfC <[hidden email]> wrote:
>> [...]So, the question is, is the boost.iostream really necessary? or is
>> shown in the example for generality?
> Boost.Process uses the types file_descriptor_source and
> file_descriptor_sink from Boost.Iostreams to wrap a file descriptor or
> Windows handle. For example, the initializers bind_stdin, bind_stdout and
> bind_stderr expect a file_descriptor_source or file_descriptor_sink to get
> a file descriptor or Windows handle which is then redirected and passed to
> the child process. I could extend those initializers though so that you
> could pass a file descriptor or Windows handle directly (without wrapping
> it in a Boost.Iostreams type)?

ok, thanks for the info. Is that a question for me? I am not familiar
with these objects. Also I use Linux only for development. These
objects didn't seem to be necessary in Boost.Process GSOC2010.

>> [...]ah, you are talking about that note, well the note says: "There is a
>> Boost.Iostreams bug on Windows...", but all these issues are in Linux.
>> I want to write a note in stackoverflow, can you confirm that the
>> problem was a bug in Boost.Iostream in linux/posix also?
> Hm, the bug in Boost.Iostreams was a Windows-only bug. I didn't experience
> any problems with any of the library's unit tests on Linux.

ok, since there is no conclusive solution, so maybe to end this thread
let me file this as a possible bug (or confirm it is the expected
behavior), the symptom is that the program never ends (linux, fedora
17, boost 1.48):

#include <boost/process.hpp> // version 0.5 from
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>
#include <string>
using namespace boost::process;
using namespace boost::process::initializers;
using namespace boost::iostreams;
int main(){
    boost::process::pipe p = create_pipe();
    file_descriptor_sink sink(p.sink, close_handle);
    child c = execute(run_exe("/usr/bin/ls"), bind_stdout(sink));
    file_descriptor_source source(p.source, close_handle);
    stream<file_descriptor_source> is(source);
    std::string s;
    while(std::getline(is, s)){
        std::cout << "read: " << s << std::endl;
    std::clog << "end" << std::endl; // never reach

View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at