]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
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 | #define BOOST_TEST_MAIN | |
11 | #define BOOST_TEST_IGNORE_SIGCHLD | |
12 | #include <boost/test/included/unit_test.hpp> | |
13 | ||
14 | #include <boost/process/error.hpp> | |
15 | #include <boost/process/io.hpp> | |
16 | #include <boost/process/child.hpp> | |
17 | #include <system_error> | |
18 | ||
19 | #include <boost/system/error_code.hpp> | |
20 | #include <cstdlib> | |
21 | #if defined(BOOST_POSIX_API) | |
22 | # include <sys/wait.h> | |
23 | #endif | |
24 | ||
25 | namespace bp = boost::process; | |
26 | ||
27 | BOOST_AUTO_TEST_CASE(closed) | |
28 | { | |
29 | using boost::unit_test::framework::master_test_suite; | |
30 | ||
31 | std::error_code ec; | |
32 | bp::child c( | |
33 | master_test_suite().argv[1], | |
34 | "test", "--is-closed-stdin", | |
35 | bp::std_in.close(), | |
36 | ec | |
37 | ); | |
38 | BOOST_REQUIRE(!ec); | |
39 | ||
40 | c.wait(); | |
41 | int exit_code = c.exit_code(); | |
42 | #if defined(BOOST_WINDOWS_API) | |
43 | BOOST_CHECK_EQUAL(EXIT_SUCCESS, exit_code); | |
44 | #elif defined(BOOST_POSIX_API) | |
45 | BOOST_CHECK_EQUAL(EXIT_SUCCESS, WEXITSTATUS(exit_code)); | |
46 | #endif | |
47 | } |