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
2
votes
2 answers

Getting exit code of boost::process::child under boost::asio::io_service?

The following program: #include #include #include int main() { boost::asio::io_service ios; boost::process::child c("/bin/ls"); ios.run(); std::cout << c.exit_code() <<…
Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319
2
votes
1 answer

Is there way to detach process from out-stream after some time?

I am using boost::process::child to spawn new process. Start time of process which I am start isn't instant, so I have to wait some time until full initialization of it. auto is_ptr = std::make_shared(); auto child_pr =…
Dcow
  • 1,413
  • 1
  • 19
  • 42
2
votes
1 answer

Passing boost::filesystem::path to boost::process::child causes exception on Windows

Example code below causes exception on Windows: #include #include using namespace boost::filesystem; using namespace boost::process; int main() { child child(exe = search_path("app", { current_path() /…
Jonny Dens
  • 49
  • 1
2
votes
2 answers

How to avoid branching for a call where the number of arguments is dependent on conditionals?

I'm converting some code from using CreateProcess to use boost-process instead. I need to replace my CreateProcess usages with boost::process::child. The problem is they have incompatible ways for me to say "I want to use the default value". What…
darune
  • 10,480
  • 2
  • 24
  • 62
2
votes
1 answer

Connect to boost named pipe

I have this code: boost::asio::io_service ios; std::vector buf(20); bp::async_pipe ap(ios, "\\\\.\\pipe\\SamplePipe"); boost::asio::async_read(ap, boost::asio::buffer(buf), [](const boost::system::error_code &ec, std::size_t size)…
parean
  • 305
  • 3
  • 13
2
votes
2 answers

Running a process using boost process in async mode with timeout

In the following code, I am trying to implement a program that runs a shell command and get the stdio, stderr and return code. I am doing it using boost process in the async mode as advised here. namespace bp = boost::process; class Process…
bisarch
  • 1,388
  • 15
  • 31
2
votes
0 answers

Why is boost::process::spawn leaving zombies behind?

I am calling an external utility (advzip) from a code to run asynchronous recompression on written data. I use boost::process::spawn to do that: // std::string f; auto p=boost::process::search_path("advzip"); if(p.empty())…
eudoxos
  • 18,545
  • 10
  • 61
  • 110
2
votes
1 answer

Pipe buffer size in boost process

I am using boost::process to read asynchronously the output of a console application in Windows. I noticed that the reading events is triggered after about 4k of data every-time. If I set my buffer 'buf' to a small value nothing changes: the event…
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173
2
votes
2 answers

Why does _popen work here, but boost::process does not?

I have the following working code using _popen, on windows, m_pGNUPlot = _popen("/gnuplot/bin/gnuplot.exe", "w"); fprintf(m_pGNUPlot, "set term win\n"); fprintf(m_pGNUPlot, "set term pngcairo\n"); fprintf(m_pGNUPlot, "plot \"\Data.txt\" using 1:2…
2
votes
1 answer

Read child process stdout in a separate thread with BOOST process

I have a main program that uses boost process library to spawn a child process that prints Hello World ! on its stdout every 5 seconds. I would like to read/monitor the stdout of the child process in the main process when it becomes available…
sbunny
  • 433
  • 6
  • 25
2
votes
1 answer

How to retrieve program output as soon as it printed?

I have a boost::process::child. There are many examples on how to get all its stdout or stderr in a single vector, but in this method you capture all data at once. But how to retrieve lines/characters as soon as they are printed in child process?
LPCWSTR
  • 33
  • 8
2
votes
2 answers

Boost::process output blank lines

I am developing an application where I need to launch and stop a variety of different executables depending on user input. I would like my "core" program to run as normal whilst these executables run, i.e not wait for their termination which could…
Rampartisan
  • 427
  • 6
  • 19
2
votes
2 answers

boost::process how to know when a process exited "gracefully or not"?

While waiting for a boost::process::child, how can you know if it exited "gracefully or not"? Let's say I create a processus: boost::process::child child( "myprg.exe", "5000" ); child.wait(); int res = child.exit_code(); Where myprg.exe is: int…
jpo38
  • 20,821
  • 10
  • 70
  • 151
2
votes
1 answer

Program hangs after calling std::future.get() using Boost.Process for asynchronous

I am creating a program that executes multiple executables asynchronously. My problem is that when I call the get() function from std::future, my program hangs up with no error. I am using Boost.Process for managing the processes and also wxWidgets…
nametable
  • 104
  • 8
2
votes
0 answers

Boost.Process terminating a child process cleanly

I wanted to spawn a child process from my application such that their lifetimes are tied i.e. when my application is closed, the child process is also closed. To achieve the same I used boost::process::child::terminate(). The problem with using…
Arun
  • 3,138
  • 4
  • 30
  • 41