...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::process::v2::check_exit_code
// In header: <boost/process/v2/exit_code.hpp> error_code check_exit_code(error_code & ec, native_exit_code_type native_code, const error_category & category = error::get_exit_code_category());
Helper to subsume an exit-code into an error_code if there's no actual error isn't set.
process proc{ctx, "exit", {"1"}}; proc.async_wait( asio::deferred( [&proc](error_code ec, int) { return asio::deferred.values( check_exit_code(ec, proc.native_exit_code()) ); [](error_code ec) { assert(ec.value() == 10); assert(ec.category() == error::get_exit_code_category()); }));