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 | |
10 | #include <boost/core/lightweight_test.hpp> |
11 | #include <iostream> |
12 | |
13 | |
14 | #include <boost/process/cmd.hpp> |
15 | #include <boost/process/error.hpp> |
16 | #include <boost/process/child.hpp> |
17 | |
18 | namespace bp = boost::process; |
19 | |
20 | int main(int argc, char* argv[]) |
21 | { |
22 | std::error_code ec; |
23 | BOOST_TEST(!ec); |
24 | |
25 | bp::child c(argv[1], ec); |
26 | BOOST_TEST(!ec); |
27 | |
28 | if (ec) |
29 | std::cerr << ec.message() << std::endl; |
30 | |
31 | auto c2 = bp::child("doesnt-exist", ec); |
32 | BOOST_TEST(ec); |
33 | |
34 | |
35 | try |
36 | { |
37 | bp::child c("doesnt-exist"); |
38 | BOOST_TEST(false); |
39 | } |
40 | catch(bp::process_error & se) |
41 | { |
42 | BOOST_TEST(true); |
43 | } |
44 | |
45 | return boost::report_errors(); |
46 | } |
47 |