Boost logo

Boost :

Subject: [boost] [boost.process] 0.6 Redesign
From: Klemens Morgenstern (klemens.morgenstern_at_[hidden])
Date: 2016-04-18 11:35:23


Hi,

I am currently working on a new version (0.6) of boost.process which
mainly provides a new interface. Most of the underlying features have be
derived from the older boost.process version. By doing all this, I tried
to hide basically all platform-specifics, so that no #ifdefs are
required as in 0.5.
It is somewhat inspired by python and std::thread.

I really hope this can help to make boost.process an official library.

At the current state, I have all functionality in the library that I
want, but it's not polished at all. Also it of course needs more tests
and documentation. But I think it sufficient to get the basic idea.

You can check it out here:
https://github.com/klemens-morgenstern/boost-process/tree/develop
And the little documentation it has is found here:
http://klemens-morgenstern.github.io/process/

Additionally here are the development notes:
https://github.com/klemens-morgenstern/boost-process/issues/2

At the current state, the tests pass on linux as well as windows (gcc-5
& MSVC-14). Requirements are C++, boost.fusion, boost.asio,
boost.iostreams, boost.filesystem and boost.system.

I really could use some feedback and hope you're interested.

Sincerely,

Klemens

Here's some sample code:

child c = execute("program", "param1", std_err > "error.log");

And to show off a little: Or you can modify the environment read the
output into a future, write the input via pipe and redirect stderr to null.

std::future<std::string> fut;
process::pipe p;
asio::io_service io_service;
auto c = execute("other-prog",
                 std_out > fut,
                 std_in < p;
                 std_err > null;
                 env["PATH"]+="/tmp",
                 env["BOOST_VERSION"]="1.61",
                 io_service);

iostreams::streams<iostreams::file_descriptor_sink> str(p.sink());

The child class binds the subprocess analogue to an std::thread, i.e. it
will wait for the process to finished. It can be detached, terminated
and waited for.


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