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
3
votes
1 answer

signal propagation from boost::process to boost::child

I am using boost::process v. 1.65.1 in a master application for Linux to create few boost::process::child objects and manage data exchanged via boost::process::std_in and boost::process::std_out i.e. pipes. When my master application receives a…
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173
3
votes
1 answer

Passing a vector or arguments to boost::process (boost::fusion)

I'm trying to create a boost::process from a vector of string arguments: void runProcess( const std::string& exe, const std::vector& args ) { bp::ipstream out; bp::child c(exe, args, std_out > out); ... } This apparently…
jpo38
  • 20,821
  • 10
  • 70
  • 151
3
votes
1 answer

"multiple definition" error when linking to boost::process 0.6

I am a bit lost with this linking error, I assume the problem lies on my side rather than in the lib itself but I don't know how to solve this. I am trying to link to boost::process 0.6 https://github.com/klemens-morgenstern/boost-process/…
pho
  • 317
  • 1
  • 10
2
votes
1 answer

What exceptions does boost::process::child throw?

In the process tutorial, it states The default behaviour of all functions is to throw an std::system_error on failure. However, the example given is using boost::process::system. Do boost::process::child functions throw a std::system_error the way…
Cecilia
  • 4,512
  • 3
  • 32
  • 75
2
votes
0 answers

Problem with boost::process with long (>260) start_dir (windows)

I am on Windows 10, and want to use boost process to start a child. When the child's working directory is too long, I get an exception: CreateProcess failed: The directory name is invalid. I wrote a test program to debug this: #include…
2
votes
1 answer

Conditionally adding arguments to a constructor (C++)

Is there a way to conditionally add arguments to a constructor? I'd also like to know what this type of construction is called so I can search it myself. I'm creating a boost::process::child using a constructor where I can pass any properties and…
Stewart
  • 4,356
  • 2
  • 27
  • 59
2
votes
1 answer

How to inherit certain fd in boost.process while close all the other fd

I am using boost.process, trying to spawn a child process and do some communication btw parent and child process. I create unnamed socket pair and pass one end to the child process. I still want to use limit_handles to close all other fd, but also…
Howard Yu
  • 171
  • 1
  • 10
2
votes
1 answer

How to send SIGTERM to a child process using boost::process

boost/process.hpp provides a nice mechanism to spawn and manage processes. It provides a child.terminate() method to send SIGKILL to a child. How would I alternatively send SIGINT or SIGTERM to a child process?
CraigDavid
  • 1,046
  • 1
  • 12
  • 26
2
votes
1 answer

boost::process How to correctly read process std::cout and std::cerr and preserve order

I'm starting a process through boost::process. The process uses std::cout and std::cerr to output some information. I need to retrieve those information. At some point, I want to be able to store those outputs preserving order and severity (output…
jpo38
  • 20,821
  • 10
  • 70
  • 151
2
votes
2 answers

Passing file or stdin to boost process child ambiguously

I am trying to write a boost::process-based program that is able ambiguously redirect input, output and error streams based on whether to not a file to redirect them into is defined, but I'm struggling to figure out how to approach it: #include…
Jack Avante
  • 1,405
  • 1
  • 15
  • 32
2
votes
2 answers

Launching a second Linux program and exit current one from C/C++?

Is it possible from a C or C++ Linux program (say /usr/bin/foo), to programmatically launch another program (say /usr/bin/bar), and have foo exit normally and for bar to keep running? system(3) isn't suitable as it blocks until the other program…
Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319
2
votes
1 answer

How to get output from a long-running child process in C++

From a C++ program, I am wanting to: Launch a child process. Wait until it emits a line of output. Capture that line of output, and allow the child process to continue running. This feels like it should be trivial, but I've tried it now two ways,…
mikepurvis
  • 1,568
  • 2
  • 19
  • 28
2
votes
1 answer

Boost::process child by id

How I can get child.id() in on_exit function? bp::child c(args, ios, bp::on_exit([&](int e, std::error_code ec) { result = e; ios.stop(); //need c.id(); })); or how I can check in other function if…
2
votes
1 answer

Boost::Process Pipe Streams and Unit Test

I have source which two stream like this: bp::ipstream StdOut; bp::opstream StdIn; bp::child MyProcess = bp::child(processPath, bp::std_out > StdOut, bp::std_in < StdIn); // Doing some stuff with StdOut and StdIn I wanted to know if there is a way…
manzerbredes
  • 310
  • 2
  • 13
2
votes
1 answer

boost::process async IO example doesn't work?

The following program: #include #include #include namespace bp = boost::process; int main() { boost::asio::io_service ios; std::vector buf(4096); bp::async_pipe ap(ios); …
Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319