Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Global on_exit

boost::process::on_exit

Synopsis

// In header: <boost/process/async.hpp>

static unspecified on_exit;

Description

When an io_service is passed, the on_exit property can be used, to be notified when the child process exits.

The following syntax is valid

on_exit=function;
on_exit(function);

with function being a callable object with the signature (int, const std::error_code&) or an std::future<int>.

Example. 

io_service ios;

child c("ls", on_exit=[](int exit, const std::error_code& ec_in){});

std::future<int> exit_code;
chlid c2("ls", on_exit=exit_code);
[Note] Note

The handler is not invoked when the launch fails.

[Warning] Warning

When used ignore_error it might gte invoked on error.


PrevUpHomeNext