spawn_fail.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #include <boost/system/error_code.hpp>
  10. #include <boost/asio.hpp>
  11. #include <boost/algorithm/string/predicate.hpp>
  12. #include <boost/process/error.hpp>
  13. #include <boost/process/io.hpp>
  14. #include <boost/process/args.hpp>
  15. #include <boost/process/spawn.hpp>
  16. #include <boost/process/async_pipe.hpp>
  17. #include <boost/process/async.hpp>
  18. #include <system_error>
  19. #include <boost/filesystem.hpp>
  20. #include <string>
  21. #include <istream>
  22. #include <cstdlib>
  23. #if defined(BOOST_WINDOWS_API)
  24. # include <windows.h>
  25. typedef boost::asio::windows::stream_handle pipe_end;
  26. #elif defined(BOOST_POSIX_API)
  27. # include <sys/wait.h>
  28. # include <unistd.h>
  29. typedef boost::asio::posix::stream_descriptor pipe_end;
  30. #endif
  31. namespace fs = boost::filesystem;
  32. namespace bp = boost::process;
  33. int main()
  34. {
  35. std::error_code ec;
  36. boost::asio::io_context ios;
  37. bp::spawn(
  38. "dummy",
  39. bp::on_exit([](int, const std::error_code&){}),
  40. ios,
  41. ec
  42. );
  43. }