close_out.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright (c) 2006, 2007 Julio M. Merino Vidal
  2. // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
  3. // Copyright (c) 2009 Boris Schaeling
  4. // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
  5. // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. #ifndef BOOST_PROCESS_WINDOWS_INITIALIZERS_CLOSE_OUT_HPP
  10. #define BOOST_PROCESS_WINDOWS_INITIALIZERS_CLOSE_OUT_HPP
  11. #include <boost/process/v1/detail/config.hpp>
  12. #include <boost/process/v1/detail/handler_base.hpp>
  13. #include <boost/winapi/process.hpp>
  14. #include <boost/winapi/handles.hpp>
  15. namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 { namespace detail { namespace windows {
  16. template<int p1, int p2>
  17. struct close_out : public ::boost::process::v1::detail::handler_base
  18. {
  19. template <class WindowsExecutor>
  20. inline void on_setup(WindowsExecutor &e) const;
  21. };
  22. template<>
  23. template<typename WindowsExecutor>
  24. void close_out<1,-1>::on_setup(WindowsExecutor &e) const
  25. {
  26. e.startup_info.hStdOutput = ::boost::winapi::INVALID_HANDLE_VALUE_;
  27. e.startup_info.dwFlags |= ::boost::winapi::STARTF_USESTDHANDLES_;
  28. }
  29. template<>
  30. template<typename WindowsExecutor>
  31. void close_out<2,-1>::on_setup(WindowsExecutor &e) const
  32. {
  33. e.startup_info.hStdError = ::boost::winapi::INVALID_HANDLE_VALUE_;
  34. e.startup_info.dwFlags |= ::boost::winapi::STARTF_USESTDHANDLES_;
  35. }
  36. template<>
  37. template<typename WindowsExecutor>
  38. void close_out<1,2>::on_setup(WindowsExecutor &e) const
  39. {
  40. e.startup_info.hStdOutput = ::boost::winapi::INVALID_HANDLE_VALUE_;
  41. e.startup_info.hStdError = ::boost::winapi::INVALID_HANDLE_VALUE_;
  42. e.startup_info.dwFlags |= ::boost::winapi::STARTF_USESTDHANDLES_;
  43. }
  44. }}}}}
  45. #endif