Questions tagged [boost-process]

Boost.Process is an accepted C++ library that handles processes in an OS-independent way and will be released with boost 1.64

The developer documentation can be found at http://www.boost.org/doc/libs/develop/doc/html/process.html

104 questions
57
votes
9 answers

Where is Boost.Process?

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…
TC.
  • 4,133
  • 3
  • 31
  • 33
11
votes
1 answer

cannot find boost_process cmake find_package

I'm trying to import boost libraries into my C++ project, and for some reason it cannot find Boost.Process, although it finds the others. My CMakeLists.txt file: cmake_minimum_required(VERSION 3.9 FATAL_ERROR) set (PROJECT_NAME "test-stuff"…
Nate C
  • 211
  • 2
  • 7
10
votes
3 answers

How to ensure that we read all lines from boost::child process

I saw the following code on boost::child documentation page where they explain how to read the output of a child process. http://www.boost.org/doc/libs/1_64_0/doc/html/boost_process/tutorial.html They say after running your child process, we can…
Utkarsh Kumar
  • 567
  • 1
  • 5
  • 17
7
votes
1 answer

How to reproduce deadlock hinted to by Boost process documentation?

According to the Boost documentation (section 'Why does the pipe not close?'), the following code will result in a deadlock: #include #include namespace bp = ::boost::process; int main(void) { bp::ipstream is; …
Ton van den Heuvel
  • 10,157
  • 6
  • 43
  • 82
6
votes
1 answer

how to redirect stdin and stdout using boost.process

i am trying to redirect both stdin and stdout of a child process. want to fill the stdin of the process with binary data from buffers and read that,(but for now i only need to know how much is written to stdout) namespace bp =…
unknown.prince
  • 710
  • 6
  • 19
5
votes
2 answers

boost::process::child will not exit after closing input stream

In the following example I try to write some data to a child process, which processes the data and writes it to a file. After closing the stream the parent process waits indefinitely for the child to finish. I am at a loss to know how to indicate…
tsnorri
  • 1,966
  • 5
  • 21
  • 29
5
votes
2 answers

Create child process with custom environment using boost

The documentation boost doesn't provide any example for creating a child process with a custom environment using process::child(...). An example is given with process::system(...) but the function system has less possible operations (such as pipes…
zack evein
  • 279
  • 5
  • 13
4
votes
2 answers

How to use boost::async_system?

I am quite new to boost, as well as to multithreading and launching application using libraries. For my desired funcitonality, I was recommended by colleague to use boost::process library. But the documentation to this part of boost is quite…
TStancek
  • 310
  • 1
  • 12
4
votes
1 answer

Get stdout of a shell command using boost process

I am trying to implement a function in C++ that runs a shell command and returns the exit code, stdout and stderr. I am using the Boost process library std::vector read_outline(std::string & file) { bp::ipstream is; //reading…
bisarch
  • 1,388
  • 15
  • 31
4
votes
1 answer

Boost process continuously read output

I'm trying to read outputs/logs from different processes and display them in a GUI. The processes will be running for long time and produce huge output. I'm planning to stream the output from those processes and display them according to my needs.…
Surya
  • 1,139
  • 1
  • 11
  • 30
3
votes
1 answer

Using boost::asio::async_write and boost::process::async_pipe to write to a child process's stdin multiple times

NOTE: I am using the words "client" and "child" interchangeably in this post to refer to the process launched from the "server". I am using boost::process::async_pipe to write the STDIN of a process that I launch using boost::process::child. Assume…
Addy
  • 2,414
  • 1
  • 23
  • 43
3
votes
1 answer

boost::process system leaking file descriptors

It seems like boost::process::system is leaking fds: Let's say I have this simple code to flush iptables config every 3 seconds (just an example): #include #include int main(void) { while(true) { …
Jussi Hietanen
  • 181
  • 1
  • 1
  • 12
3
votes
1 answer

Can't get segmentation fault exit code from boost child process

I am trying to get the exit code of a child process (using boost::process and boost::asio) when that child process is killed due to a segmentation violation or divide be zero or any other kill signal. The exit code and error code always return with…
Dave B.
  • 33
  • 4
3
votes
1 answer

Is wait() needed after run() in boost process async child process?

I am using Boost Process in async mode to get the stdout, stderr and return code of a shell command. In the code snippet below, is the call c.wait() required? According to Boost Process 1.68 documentation it is not required where as it is required…
bisarch
  • 1,388
  • 15
  • 31
3
votes
1 answer

Prevent child process from inheriting parent process's opened TCP ports with boost process library

I have a C++ application listening on a particular TCP port. The application also launches a child process using the Boost child class from Boost process library. As soon as the child is launched the output of netstat command shows that the TCP port…
sbunny
  • 433
  • 6
  • 25
1
2 3 4 5 6 7