|  | Home | Libraries | People | FAQ | More | 
boost::process::on_exit
// In header: <boost/process/async.hpp> static unspecified on_exit;
When an io_context 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_context ios; child c("ls", ios, on_exit=[](int exit, const std::error_code& ec_in){}); std::future<int> exit_code; chlid c2("ls", ios, on_exit=exit_code);
| ![[Note]](../../../../doc/src/images/note.png) | Note | 
|---|---|
| The handler is not invoked when the launch fails. | 
| ![[Warning]](../../../../doc/src/images/warning.png) | Warning | 
|---|---|
| When used ignore_error it might get invoked on error. | 
| ![[Warning]](../../../../doc/src/images/warning.png) | Warning | 
|---|---|
| 
 |