boost process : how to use it
Hi,
What is the status of boost:process, when looking on internet you can
find different version that are more or less compatible.
Not an ideal situation and I am a bit surprised that this lib doesn't
get more love from c++ dev.
Anyway after a long time coding in easier language I decided to do a
small project under linux that consists in a tcp server running
on linux that start some process initiated by a client and sends the
output.
So I have downaloaded the most "official" version I could find here
http://www.highscore.de/boost/process/ and I tried the following code :
#include <cassert>
#include <iostream>
#include <map>
#include <string>
#include <sstream>
#include <vector>
#include
On Tue, Jan 7, 2014 at 8:44 AM, Vincent R.
Hi,
What is the status of boost:process, when looking on internet you can find different version that are more or less compatible. Not an ideal situation and I am a bit surprised that this lib doesn't get more love from c++ dev. Anyway after a long time coding in easier language I decided to do a small project under linux that consists in a tcp server running on linux that start some process initiated by a client and sends the output. So I have downaloaded the most "official" version I could find here http://www.highscore.de/boost/process/ and I tried the following code :
#include <cassert> #include <iostream> #include <map> #include <string> #include <sstream> #include <vector> #include
#include #include namespace asio = boost::asio; namespace bp = boost::process; using asio::ip::tcp;
bp::child start_child() { std::string exec = boost::process::find_executable_in_path("dpkg"); std::vectorstd::string args; args.push_back("-l");
bp::context ctx; ctx.stderr_behavior = bp::capture_stream();
return bp::launch(exec, args, ctx); }
int main(int argc, char *argv[]) { std::string value;
bp::child c = start_child(); bp::pistream &is = c.get_stderr(); std::string line; while (std::getline(is, line)) { value += line + "\r\n"; } c.wait();
std::cout << "OUTPUT: " << value << std::endl;
return 0; }
My first question is how can I merge the stderr with stdout because some commands use stdout and some others stderr ?
My second question is : why the code above doesn't work properly and doesn't handle the arguments I am passing ? Indeed when I run the code I get the following output :
OUTPUT: dpkg: error: need an action option
it means that the -l is not taken in consideration.
Thanks for any help
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
For what its worth, this is the more recent version: http://www.highscore.de/boost/process0.5/ Brian
On Tuesday, January 07, 2014 8:44 AM, Boost-users wrote:
Hi,
What is the status of boost:process, when looking on internet you can find different version that are more or less compatible. Not an ideal situation and I am a bit surprised that this lib doesn't get more love from c++ dev.
<snip> I'm also curious why this library hasn't been integrated into the standard set of Boost libraries. Would someone be kind enough to provide some (current) background on the latest thinking/status of this? Thanks, -David
On Jan 9, 2014, at 10:32 AM, David Hauck
On Tuesday, January 07, 2014 8:44 AM, Boost-users wrote:
Hi,
What is the status of boost:process, when looking on internet you can find different version that are more or less compatible. Not an ideal situation and I am a bit surprised that this lib doesn't get more love from c++ dev.
<snip>
I'm also curious why this library hasn't been integrated into the standard set of Boost libraries. Would someone be kind enough to provide some (current) background on the latest thinking/status of this?
Because it has not yet been accepted into Boost. It was reviewed a couple years ago, and rejected (for good reasons). Boris has spent a lot of time reworking the library, and plans to resubmit it for review. — Marshall (who was the review manager)
On Thu, Jan 9, 2014 at 7:50 PM, Marshall Clow
Boris has spent a lot of time reworking the library, and plans to resubmit it for review.
Nice! Can't wait to try it. I'm using the 0.5 version but in a very simple case since it was proposed. The issues indeed were good reasons for rejection and I was a bit afraid that it had killed motivation to resubmit another version. By the way, Emmanuel Deloget was also working for a standard proposal for a process library, I don't know if he is still working on it: https://code.google.com/p/edt-process-cpp1y/ I don't remember if he mentionned a potential inclusion in Boost. The "style" of that library is very different compared the boost proposals so far (as you can see in the example).
Hi Marshall, On Thursday, January 09, 2014 10:51 AM, Boost-users wrote:
On Jan 9, 2014, at 10:32 AM, David Hauck
wrote: On Tuesday, January 07, 2014 8:44 AM, Boost-users wrote:
Hi,
What is the status of boost:process, when looking on internet you can find different version that are more or less compatible. Not an ideal situation and I am a bit surprised that this lib doesn't get more love from c++ dev.
<snip>
I'm also curious why this library hasn't been integrated into the standard set of Boost libraries. Would someone be kind enough to provide some (current) background on the latest thinking/status of this?
Because it has not yet been accepted into Boost.
Ya, I figured that ;).
It was reviewed a couple years ago, and rejected (for good reasons).
OK, this is part of what I was looking for: where would I find the results of that review?
Boris has spent a lot of time reworking the library, and plans to resubmit it for review.
...and this is the second part of what I was looking for. Does anyone have any idea of timeframe for this? I realize the review process time frame is somewhat indeterminate, but wondered about the nominal time for review of a library of this size/complexity and also any approximation for the time frame for re-submission? Thanks! -David
- Marshall (who was the review manager)
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Jan 9, 2014, at 11:10 AM, David Hauck
Hi Marshall,
On Thursday, January 09, 2014 10:51 AM, Boost-users wrote:
On Jan 9, 2014, at 10:32 AM, David Hauck
wrote: On Tuesday, January 07, 2014 8:44 AM, Boost-users wrote:
Hi,
What is the status of boost:process, when looking on internet you can find different version that are more or less compatible. Not an ideal situation and I am a bit surprised that this lib doesn't get more love from c++ dev.
<snip>
I'm also curious why this library hasn't been integrated into the standard set of Boost libraries. Would someone be kind enough to provide some (current) background on the latest thinking/status of this?
Because it has not yet been accepted into Boost.
Ya, I figured that ;).
It was reviewed a couple years ago, and rejected (for good reasons).
OK, this is part of what I was looking for: where would I find the results of that review?
In the boost-developer’s mailing list archives. http://lists.boost.org/Archives/boost/2011/03/178147.php [ Really, you should read the discussion - though it was a couple hundred messages. The review result is an attempt to summarize. ] http://lists.boost.org/Archives/boost/
Boris has spent a lot of time reworking the library, and plans to resubmit it for review.
...and this is the second part of what I was looking for. Does anyone have any idea of timeframe for this? I realize the review process time frame is somewhat indeterminate, but wondered about the nominal time for review of a library of this size/complexity and also any approximation for the time frame for re-submission?
That’s a question for Boris to answer ;-) — Marshall
On Thursday, January 09, 2014 12:05 PM, Boost-users wrote:
On Jan 9, 2014, at 11:10 AM, David Hauck
wrote: Hi Marshall, On Thursday, January 09, 2014 10:51 AM, Boost-users wrote: On Jan 9, 2014, at 10:32 AM, David Hauck wrote: On Tuesday, January 07, 2014 8:44 AM, Boost-users wrote: Hi, What is the status of boost:process, when looking on internet you can find different version that are more or less compatible. Not an ideal situation and I am a bit surprised that this lib doesn't get more love from c++ dev.
<snip>
I'm also curious why this library hasn't been integrated into the standard
set of Boost libraries. Would someone be kind enough to provide some (current) background on the latest thinking/status of this?
Because it has not yet been accepted into Boost.
Ya, I figured that ;).
It was reviewed a couple years ago, and rejected (for good reasons).
OK, this is part of what I was looking for: where would I find the results of that review?
In the boost-developer's mailing list archives. http://lists.boost.org/Archives/boost/2011/03/178147.php
[ Really, you should read the discussion - though it was a couple hundred messages. The review result is an attempt to summarize. ] http://lists.boost.org/Archives/boost/
Boris has spent a lot of time reworking the library, and plans to resubmit it for review.
...and this is the second part of what I was looking for. Does anyone have any idea of timeframe for this? I realize the review process time frame is somewhat indeterminate, but wondered about the nominal time for review of a library of this size/complexity and also any approximation for the time frame for re-submission?
That's a question for Boris to answer ;-)
Thanks Marshall.
On Tue, 07 Jan 2014 17:44:10 +0100, Vincent R.
Hi,
What is the status of boost:process, when looking on internet you can find different version that are more or less compatible. [...]
Let me try to answer all questions from this thread: The latest version of what everyone calls Boost.Process is http://www.highscore.de/boost/process0.5/. As this version looks very different than the previous ones I recommend ignoring all other Boost.Process versions. The last change is from December 2012. It doesn't mean though that development has stopped. To a certain extent the version is complete. It is based on a relatively new proposal from Jeff Flinn, and all the changes (regarding code, unit tests and documentation) in 2012 were done to bring Jeff's proposal to life. That again made me propose the latest version for a new review. All of that doesn't mean that the version is perfect. I'm in contact with many people by email, and there are from time to time various discussions (by email) on how to improve the library. In fact I've a list of problems which I know should be worked on. The majority of problems however have to do with the question how conceptual differences between supported platforms should be treated. As the library is under construction for about 8 years I believe we have the knowledge and even the code for every desired feature an official version 1.0 of a C++ process management library should support. But we struggle with agreeing on red lines. From a maintenance point of view Boost.Process is as much supported as any other Boost library (or actually most of them if you know what I mean :). That said if you run into a bug let me know - I'm usually quick trying to reproduce and fix it (as of today there are no known bugs). Overall, the library might be far from perfect. But it does allow you to do whatever you want when it comes to process management. In that sense I believe it has a lot in common with C++. ;) Boris
participants (6)
-
Boris Schäling
-
Brian Budge
-
David Hauck
-
Klaim - Joël Lamotte
-
Marshall Clow
-
Vincent R.