
Boris Schaeling wrote:
Here are the results of the Boost.Process project within this year's Google Summer of Code program: We have a complete library to manage system processes now!
If you like to play around with the library download the ZIP file from <http://www.highscore.de/boost/gsoc2010/process.zip>. As it's a header-only library simply copy the files to your Boost folder. If you like to quickly check the documentation click on <http://www.highscore.de/boost/gsoc2010/>.
Consider this program (untested): // simulate daemon process for (int i = 0; i < F_MAXFD; ++i) close(i); namespace bp == boost::process; bp::context ctx; // 1 ctx.stderr_behavior = bp::behavior::pipe::create( bp::behavior::pipe::output_stream); // 2 ctx.stdout_behaviour = bp::behavior::pipe::create( bp::behavior::pipe::output_stream); // 3 bp::child foo = bp::create_child("foo", std::vector<std::string>(), ctx); After line 1 we have: fd refers to 0 rend of pipe created for stderr 1 wend of pipe created for stderr After line 2: 0 rend of pipe created for stderr 1 wend of pipe created for stderr 2 rend of pipe created for stdout 3 wend of pipe created for stdout Now after line 3 the child process has the following fds: 0 closed 1 wend of pipe created for stdout 2 wend of pipe created for stdout (!) 3 closed