|
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 15:36:53
On Sat, Sep 15, 2012 at 8:46 AM, Boris Schaeling [via Boost]
<ml-node+s2283326n4635808h26_at_[hidden]> wrote:
> On Wed, 12 Sep 2012 22:10:12 +0200, alfC <[hidden email]> wrote:
>
>> [...]I have a small criticism (probably from ignorance) and it is that
>> the
>> new version seems to be more complicated to use than the previous
>> versions.
>
> Oh, do you have an example for me to see where you think the new version
> is more complicated than the previous one?
Well, in the first place: the added dependecy on boost.iostreams which
I was not familiar with.
Which in addition is not a header-only library.
Second, in the example code, there are four lines (marked with *) just
to set up the stream,
* 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);
if I were to have an output stream I would need four more lines
presumably (I would be nice to have a complete example of asynchonic
both input and output).
So, the question is, is the boost.iostream really necessary? or is
shown in the example for generality?
Even if boost.iostream lines are necessary, can they be that wrapped
away (by the user), or the library, such that you have something that
just works? For example:
process::iostream ps("/usr/bin/ls"); // or as a function auto ps =
process::create_iostream("/usr/bin/ls");
// bang!, ps is ready for io operations,
>
>> [...] If that is the case you can add a warning in the library to not
>> compile with old versions of boost.
>> someone at stackoverflow, suggested to open the process asynchronously
>> and do a status check.
>> (see
>>
>> http://stackoverflow.com/questions/12329065/how-to-bind-program-termination-with-end-of-stream-in-boost-process-0-5)
>> Seemed like an ovekill. I am glad it is a bug instead.
>
> There is actually a note at
> <http://www.highscore.de/boost/process0.5/boost_process/tutorial.html#boost_process.tutorial.synchronous_i_o>
> to inform users about that bug in Boost.Iostreams. Maybe it shouldn't be a
> note but a warning or something else which can't be overlooked easily? :)
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?
Thanks,
Alfredo
-- View this message in context: http://boost.2283326.n4.nabble.com/How-to-bind-program-termination-with-end-of-stream-in-Boost-Process-0-5-tp4635497p4635814.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk