error.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) 2021 Klemens D. Morgenstern
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_PROCESS_V2_ERROR_HPP
  6. #define BOOST_PROCESS_V2_ERROR_HPP
  7. #include <boost/process/v2/detail/config.hpp>
  8. BOOST_PROCESS_V2_BEGIN_NAMESPACE
  9. namespace error
  10. {
  11. /// Errors used for utf8 <-> UCS-2 conversions.
  12. enum utf8_conv_error
  13. {
  14. insufficient_buffer = 1,
  15. invalid_character,
  16. };
  17. extern BOOST_PROCESS_V2_DECL const error_category& get_utf8_category();
  18. static const error_category& utf8_category = get_utf8_category();
  19. extern BOOST_PROCESS_V2_DECL const error_category& get_exit_code_category();
  20. /// An error category that can be used to interpret exit codes of subprocesses.
  21. /** Currently not used by boost.process, but it might be in the future.
  22. *
  23. * void run_my_process(filesystem::path pt, error_code & ec)
  24. * {
  25. * process proc(pt, {});
  26. * proc.wait();
  27. * ec.assign(proc.native_exit_code(), error::get_exit_code_category());
  28. * }
  29. *
  30. * */
  31. static const error_category& exit_code_category = get_exit_code_category();
  32. }
  33. BOOST_PROCESS_V2_END_NAMESPACE
  34. #endif //BOOST_PROCESS_V2_ERROR_HPP