Boost logo

Boost :

Subject: Re: [boost] [process] Formal review results
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-11-09 17:26:47


On 10/11/2016 09:00, Klemens Morgenstern wrote:
> That did however allow one additional feature: with the pipe
> automatically closing, you can now use a part of the asio stuff with
> bp::spawn.
>
> asio::io_service ios;
> std::future<std::string> fut;
> bp::spawn("foo", std_out > fut, ios);
>
> Not sure this is the smartest thing to do, but it could make sense for
> some simple applications.

That's quite nice, actually -- a large number of applications would just
want to pull the complete output from a process, either with no input or
with completely provided input. It's probably less common to need to
hold an interactive conversation, so having a nice quick syntax that
hides the stream/pipe work internally is a pretty good win.

Having said that, is there an inverse of this for providing the complete
input? Presumably std_in < std::string(x) can't work, as this would be
confused with a filename. (And while wrapping it in a future is
possible, it'd be a bit silly.)

This sort of thing kinda makes me wish that the originally proposed
future_stream survived into Boost or the standard. Though you can
simulate one with a composite future (a future that returns a value and
a new future); I have an implementation kicking around somewhere. It's
not the prettiest of things nor would it be a simple drop-in though, I
think.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk