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

PrevUpHomeNext

Function check_exit_code

boost::process::v2::check_exit_code

Synopsis

// 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());

Description

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());
   }));


PrevUpHomeNext