56

I need to execute a program and retrieve its stdout output in c++. I'd like my code to be cross-platform too.

Having recently discovered the wonderful world of the Boost c++ libraries for all your cross platform needs, I figured I'd just go to boost.org and read up on the documentation of Boost.Process. Much to my surprise, it wasn't there! I then proceeded to figure out what name Boost gave their cross-platform library to start external processes, but haven't managed to find it so far.

A Google search brought me to Julio M. Merino Vidal's Boost.Process, which seems to be the unofficial Boost library I was looking for. Strangely enough, I cannot seem to find a download link on that website. It also seems like there haven't been any recent developments regarding the project.

I was finally able to find a download link for Vidal's Boost.Process on an external site and will use that for now, but I'm quite amazed at the effort I had to put in to get my hands on a cross platform c++ library to interact with external processes.

So, why is there no official Boost.Process? It seems like it would be a very valuable addition. Or am I totally overlooking the obvious solution here? Could you perhaps suggest other cross-platform libraries for managing simple starting of and interation with external processes?

alfC
  • 10,293
  • 4
  • 42
  • 88
TC.
  • 3,825
  • 3
  • 28
  • 32
  • 1
    Congratulations on the discovery -- Boost rocks! – vehomzzz Nov 05 '09 at 21:31
  • Boost rocks, but there's no official Process library yet. For what it's worth, I successfully used the Poco Process library in the past (Google for the Poco C++ libraries for more information). – StackedCrooked Nov 05 '09 at 22:52

9 Answers9

62

Boost.Process was accepted for inclusion into Boost on November 9, 2016; and has been included in the 1.64 released on April 19, 2017. Boost.Process is now an official Boost library!

It's documentation is available here: http://www.boost.org/doc/libs/1_64_0/doc/html/process.html


For the record, the sources that were reviewed from October 27, 2016 through November 5, 2016 are available on GitHub:

download: https://github.com/klemens-morgenstern/boost-process

manual: http://klemens-morgenstern.github.io/process/index.html


You can find on the web several older versions of this library. They are all more or less incompatible:

  • Version 0.5 (latest, as of 3rd Dec 2012)

download: http://www.highscore.de/boost/process0.5/process.zip

manual: http://www.highscore.de/boost/process0.5/index.html

  • Version GSOC2010

download: http://www.highscore.de/boost/gsoc2010/process.zip

manual: http://www.highscore.de/boost/gsoc2010/

  • Version 0.31

download: http://www.highscore.de/boost/process.zip

manual1: http://www.highscore.de/boost/process/

manual2: http://www.highscore.de/cpp/process/

I think it is the same as in http://svn.boost.org/svn/boost/sandbox/process/boost/

  • I.S. Version 0.1-0.4

download: https://github.com/boost-vault/Process

  • Version 0?

download: http://www.netbsd.org/~jmmv/process.zip

manual: http://www.netbsd.org/~jmmv/process/

There are other version that look like branches: https://github.com/JeffFlinn/boost-process and https://github.com/boost-vault/Process.

For a partial history of the project, look at http://www.highscore.de/cpp/process/#introduction

alfC
  • 10,293
  • 4
  • 42
  • 88
30

Julio M. Merino Vidal, who is, I beleive, the original author, wrote in this 2007 post that he did not have time to complete it.

Development was taken over by Boris Schaeling. This is the version that you found at http://www.highscore.de/boost/process/. According to this post, he is still actively developing it.

There is another version, by Ilya Sokolov.

For your other question:

Could you perhaps suggest other cross-platform libraries for managing simple starting of and interation with external processes?

you could look at this wiki page listing alternatives.

Depending on your needs, popen() could also do the job.

Community
  • 1
  • 1
Éric Malenfant
  • 13,450
  • 1
  • 36
  • 41
  • 7
    Just to complete information here, I would link the [review schedule](http://www.boost.org/community/review_schedule.html) in which is stated that boost.process has been [rejected](http://lists.boost.org/boost-announce/2011/03/0292.php). – dave Oct 03 '11 at 08:30
  • 3
    This answer isn't up to date anymore, see the community wiki answer. – Klaim Jul 10 '13 at 21:52
8

As of August 18th 2012, a newer version of Boost.Process (v0.5) has been released at http://www.highscore.de/boost/process0.5/

hope that helps, Philipp

Philipp Aumayr
  • 1,370
  • 11
  • 14
8

Boost Process was one of the Google Summer of Code projects this year. The GSOC 2010 Boost Process website is http://www.highscore.de/boost/gsoc2010/.

The library is still unofficial, but its developers feel that it is stable enough to request formal review.

Daniel Trebbien
  • 35,770
  • 14
  • 104
  • 182
  • 2
    It got rejected due to various concerns, I hope they will address those and resubmit. – maep Oct 24 '11 at 10:56
4

Another option might be the modularly designed POCO, see Process::launch() which has an overload that takes Pipes for in, out and error.

Georg Fritzsche
  • 93,086
  • 26
  • 183
  • 232
3

It looks like Boost.Process is in the sandbox area, which would suggest that it has been proposed for inclusion and is probably still being work on, but hasn't been deemed stable, documented and/or useful enough to be included in the main boost release.

Timo Geusch
  • 23,267
  • 4
  • 48
  • 70
2

For July 2015 it seems like Boost.Process has been scheduled for the Boost formal review again.

firegurafiku
  • 2,491
  • 21
  • 34
1

Parts of Boost.Process are available in several stand-alone libraries in Boost now: Boost.Interprocess, Program Options, etc.

Kirill V. Lyadvinsky
  • 89,955
  • 22
  • 127
  • 208
1

The new Boost Process is now in beta and will be available in Boost 1.64.0.

http://www.boost.org/doc/libs/1_64_0_b2/doc/html/process.html

Pietro
  • 10,628
  • 22
  • 80
  • 165