cmd.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright (c) 2022 Klemens D. Morgenstern
  2. // Copyright (c) 2022 Samuel Venable
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_PROCESS_V2_CMD_HPP
  7. #define BOOST_PROCESS_V2_CMD_HPP
  8. #include <string>
  9. #include <vector>
  10. #include <boost/process/v2/detail/config.hpp>
  11. #include <boost/process/v2/detail/throw_error.hpp>
  12. #include <boost/process/v2/process_handle.hpp>
  13. #include <boost/process/v2/pid.hpp>
  14. #include <boost/process/v2/shell.hpp>
  15. BOOST_PROCESS_V2_BEGIN_NAMESPACE
  16. namespace ext {
  17. /// @{
  18. /// Get the argument vector of another process
  19. BOOST_PROCESS_V2_DECL shell cmd(pid_type pid, error_code & ec);
  20. BOOST_PROCESS_V2_DECL shell cmd(pid_type pid);
  21. #if defined(BOOST_PROCESS_V2_WINDOWS)
  22. BOOST_PROCESS_V2_DECL shell cmd(HANDLE handle, error_code & ec);
  23. BOOST_PROCESS_V2_DECL shell cmd(HANDLE handle);
  24. #endif
  25. template<typename Executor>
  26. BOOST_PROCESS_V2_DECL shell cmd(basic_process_handle<Executor> & handle, error_code & ec)
  27. {
  28. #if defined(BOOST_PROCESS_V2_WINDOWS)
  29. return cmd(handle.native_handle(), ec);
  30. #else
  31. return cmd(handle.id(), ec);
  32. #endif
  33. }
  34. template<typename Executor>
  35. BOOST_PROCESS_V2_DECL shell cmd(basic_process_handle<Executor> & handle)
  36. {
  37. #if defined(BOOST_PROCESS_V2_WINDOWS)
  38. return cmd(handle.native_handle());
  39. #else
  40. return cmd(handle.id());
  41. #endif
  42. }
  43. /// @}
  44. } // namespace ext
  45. BOOST_PROCESS_V2_END_NAMESPACE
  46. #if defined(BOOST_PROCESS_V2_HEADER_ONLY)
  47. #include <boost/process/v2/ext/impl/cmd.ipp>
  48. #endif
  49. #endif // BOOST_PROCESS_V2_CMD_HPP