13 #include <boost/system/error_code.hpp>
19 template <
class Process>
22 if (::WaitForSingleObject(p.process_handle(), INFINITE) == WAIT_FAILED)
24 BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR(
"WaitForSingleObject() failed");
28 if (!::GetExitCodeProcess(p.process_handle(), &exit_code))
30 BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR(
"GetExitCodeProcess() failed");
36 template <
class Process>
37 inline DWORD
wait_for_exit(
const Process& p, boost::system::error_code& ec)
41 if (::WaitForSingleObject(p.process_handle(), INFINITE) == WAIT_FAILED)
43 BOOST_PROCESS_RETURN_LAST_SYSTEM_ERROR(ec);
45 else if (!::GetExitCodeProcess(p.process_handle(), &exit_code))
47 BOOST_PROCESS_RETURN_LAST_SYSTEM_ERROR(ec);