Boost logo

Boost :

Subject: Re: [boost] Process library with child process events
From: Jeff Flinn (Jeffrey.Flinn_at_[hidden])
Date: 2011-06-06 08:54:01

Giorgio Zoppi wrote:
> I think that It is too complicated. Probally I need a more simple
> layer. Something that i can use:
> std:vector<string> arg;
> p = process('/usr/bin/vi', args=('bob',));
> p.start();
> p.join();

The current design allows you to do the above, where make_child creates
and starts a child process. A monitor allows you to join with a

using namespace boost::process;

child c = make_child(paths(“/usr/bin/vi”), args(“bob”));


> Something that has an object process_pool.

Can you expand on what you mean by process pool? I've run into a use
case where I'd like to launch several processes(one per core) and join
all. Is that along the lines of what you were thinking? I do this now in
client code but will try to get this formalized and added to the library.

> A pipe object between processes, a queue object a signal handler and
> nothing else.

The library provides a 'directed' pipe, which is currently named
boost::process::file_descriptor_ray(yep, in search of a better name). It
allows communication between parent and/or child processes. One use is
to access a child's std_out via a stream by the parent.

For example I needed to grab the output of an exe to parse it's version

namespace io = boost::iostreams;
typedef io::stream<io::file_descriptor_source> source;

file_descriptor_ray ray;

monitor m(make_child(paths(exe), Args(arg), std_out_to(ray)));

ray.m_sink.close(); // currently req's manual closing

source redirected(ray.m_source);

Tuple version(parse(redirected)); // parse the istream



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