diff --git a/include/boost/process/v2/process.hpp b/include/boost/process/v2/process.hpp index 5643e3927..fd09281c5 100644 --- a/include/boost/process/v2/process.hpp +++ b/include/boost/process/v2/process.hpp @@ -355,8 +355,7 @@ struct basic_process } }; - net::post(handle.get_executor(), - completer{static_cast(res), std::move(self)}); + net::post(handle.get_executor(), completer{static_cast(res), std::move(self)}); } else handle.async_wait(std::move(self)); @@ -371,7 +370,10 @@ struct basic_process { if (!ec) res = code; - std::move(self).complete(ec, evaluate_exit_code(code)); + else if (ec == boost::system::errc::no_child_process) + std::move(self).complete({}, evaluate_exit_code(res)); + else + std::move(self).complete(ec, evaluate_exit_code(code)); } } };