1 // Copyright (c) 2016 Klemens D. Morgenstern
\r
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
\r
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
\r
6 #ifndef BOOST_PROCESS_WINDOWS_ON_EXIT_HPP_
\r
7 #define BOOST_PROCESS_WINDOWS_ON_EXIT_HPP_
\r
9 #include <boost/process/detail/config.hpp>
\r
10 #include <boost/process/detail/handler_base.hpp>
\r
11 #include <boost/process/detail/windows/async_handler.hpp>
\r
12 #include <boost/detail/winapi/process.hpp>
\r
13 #include <system_error>
\r
14 #include <functional>
\r
16 namespace boost { namespace process { namespace detail { namespace windows {
\r
18 struct on_exit_ : boost::process::detail::windows::async_handler
\r
20 std::function<void(int, const std::error_code&)> handler;
\r
21 on_exit_(const std::function<void(int, const std::error_code&)> & handler) : handler(handler)
\r
26 template<typename Executor>
\r
27 std::function<void(int, const std::error_code&)> on_exit_handler(Executor&)
\r
29 auto handler = this->handler;
\r
30 return [handler](int exit_code, const std::error_code & ec)
\r
32 handler(static_cast<int>(exit_code), ec);
\r
40 #endif /* INCLUDE_BOOST_PROCESS_WINDOWS_ON_EXIT_HPP_ */
\r