File indexing completed on 2025-01-18 09:50:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_PROCESS_DETAIL_POSIX_TERMINATE_HPP
0011 #define BOOST_PROCESS_DETAIL_POSIX_TERMINATE_HPP
0012
0013 #include <boost/process/detail/config.hpp>
0014 #include <boost/process/detail/posix/child_handle.hpp>
0015 #include <system_error>
0016 #include <signal.h>
0017 #include <sys/wait.h>
0018
0019
0020 namespace boost { namespace process { namespace detail { namespace posix {
0021
0022 inline void terminate(const child_handle &p, std::error_code &ec) noexcept
0023 {
0024 if (::kill(p.pid, SIGKILL) == -1)
0025 ec = boost::process::detail::get_last_error();
0026 else
0027 ec.clear();
0028
0029 int status;
0030 ::waitpid(p.pid, &status, 0);
0031 }
0032
0033 inline void terminate(const child_handle &p)
0034 {
0035 std::error_code ec;
0036 terminate(p, ec);
0037 boost::process::detail::throw_error(ec, "kill(2) failed");
0038 }
0039
0040 }}}}
0041
0042 #endif