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
1
vote
1 answer

Interfacing with executable using boost in c++

I am trying to interface a program I'm writing with an existing chess engine (stockfish) in C++. To do this I'm using Boost but am having problems with processes. engine.exe is the executable I'm trying to interface with but it seems to be…
jmcd
  • 15
  • 5
1
vote
0 answers

Reading wide character output from child process on Windows

My application has to run on Windows and uses the unicode character set. When I try to read the output with the following commands I get only scrambled output, however replacing all types with the char_t equivalents works unless there are…
1
vote
1 answer

Cannot get boost::process to find gstreamer plugin

I'm trying to load a gstreamer plugin using boost::process to call gst-launch. When I load the plugin via the command line everything works well: gst-launch-1.0 videotestsrc ! privacyprotector ! fakesink If I use the full path to the executable, it…
ruipacheco
  • 15,025
  • 19
  • 82
  • 138
1
vote
1 answer

Boost Process 1.71 does not look in environment path anymore

I have been using boost 1.65, did not change the code, updated boost to version 1.71 and now suddenly boost::process::child("command-in-path") does not inherit the environment of the executing process. How can I recover the behavior, is it possible…
Yuki
  • 3,857
  • 5
  • 25
  • 43
1
vote
1 answer

Boost Process exit code of terminated process

What should be a return code of a terminated process? I run "bash -c \"while true; do true; done\"" and call terminate. In boost 1.65 it was 0, now in boost 1.71 it is 383.
Yuki
  • 3,857
  • 5
  • 25
  • 43
1
vote
0 answers

Process terminating on windows when cmd.exe closes?

I have a program (lets call it prog1.exe) that launches another program (lets call it prog2.exe) with: // in prog1.exe: boost::process::spawn("prog2.exe", ...); If I launch cmd.exe: C:\> and then run prog1.exe: C:\> prog1.exe then: prog1.exe…
Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319
1
vote
2 answers

Using boost to create multiple child processes to be run asynchronously

How do I spawn multiple child processes that should run asynchronously? Do I use a vector of child processes? I'm afraid the code below doesn't do what I'm trying to accomplish. Any other suggestions for a different way to pass arguments to the…
Bruno
  • 1,329
  • 2
  • 15
  • 35
1
vote
1 answer

Stop child processes after main program exits c++

After the completion of the parent's work, is the child still alive? If so, how can I kill him if the main process is complete? I used boost libraries (boost process, boost asio). If it possible it should be a solution for MacOs, Windows and…
1
vote
0 answers

Read and write to the same unnamed pipe(boost::process::pstream) in child process

I am trying to implement reading and writing in the child process from/to the same pipe. Instead of pipe I'm using boost::process::pstream and redirecting stdin and stdout in child process to that stream. Simple example. I send a message from the…
Hlib Pylypets
  • 328
  • 2
  • 8
1
vote
1 answer

Boost.Process - reading from process with sleeping loop

I have certain problem and I am not sure what I am doing wrong. //sleeper.exe int main() { int i = 0; while (true) { printf("%i\n", ++i); sleep_for(1s); } return 0; } I want to capture sleeper's output in my application and add…
Kasata Ata
  • 365
  • 3
  • 11
1
vote
1 answer

Reading output of blocking process

I have some simple application: //first.exe int main() { std::cout << "1" << std::endl; std::cout << "2" << std::endl; std::cout << "3" << std::endl; std::cin.get(); return 0; } And I want to invoke a callback in separate application…
Kasata Ata
  • 365
  • 3
  • 11
1
vote
0 answers

`boost::asio::io_context` with `boost::process::async_pipe`: is there a way to run it reliably?

With Windows API, we can use pipes to forward process output and error streams, so we can read process output without any temporary files. Instead of this: std::system("my_command.exe > out.tmp"); we can work much faster and without risk to…
Vitalii
  • 4,434
  • 4
  • 35
  • 77
1
vote
0 answers

Boost Process fails on Solaris 10 in async mode

I am using boost process in async mode to run shell commands from a C++ application. The following code works well in Linux (CentOS 7 in my case), but fails on Solaris 10. On Solaris 10, the return code is 127 and stdout and stderr are empty.…
bisarch
  • 1,388
  • 15
  • 31
1
vote
0 answers

boost::process child terminates before all of stdout can be read

I want to use boost-process to read the stdout from a command: std::string command = "cat /tmp/my_file"; namespace bp = boost::process; bp::ipstream is; bp::child c(command, bp::std_out > is); std::string line; int no_lines = 0; while…
John
  • 451
  • 7
  • 17
1
vote
1 answer

Blocking signals causes boost process not to work

In the code below the class Process can run a process using boost process in asynchronous mode and can kill it if it times out. Now in order to shut it down, I block all the signals in all threads and create a specific thread signal_thread to handle…
bisarch
  • 1,388
  • 15
  • 31