diff --git a/include/boost/process.hpp b/include/boost/process.hpp index d148d836..ebf08699 100644 --- a/include/boost/process.hpp +++ b/include/boost/process.hpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/process/child.hpp b/include/boost/process/child.hpp index f73ce67c..13b4f946 100644 --- a/include/boost/process/child.hpp +++ b/include/boost/process/child.hpp @@ -17,159 +17,34 @@ #ifndef BOOST_PROCESS_CHILD_HPP #define BOOST_PROCESS_CHILD_HPP -#include -#include -#include +#include +#include -#include -#include - - -#if defined(BOOST_POSIX_API) -#include -#include -#include -#include -#elif defined(BOOST_WINDOWS_API) -#include -#include -#include -#include - -#endif namespace boost { namespace process { -using ::boost::process::detail::api::pid_t; +template +child::child(Args&&...args) : child(detail::execute_impl(std::forward(args)...)) {} -class child + +template +inline void spawn(Args && ...args) { - ::boost::process::detail::api::child_handle _child_handle; - std::shared_ptr> _exit_status = std::make_shared>(boost::process::detail::api::still_active); - bool _attached = true; - bool _terminated = false; - - bool _exited() - { - return _terminated || !::boost::process::detail::api::is_running(_exit_status->load()); - }; -public: - typedef ::boost::process::detail::api::child_handle child_handle; - typedef child_handle::process_handle_t native_handle_t; - explicit child(child_handle &&ch, const std::shared_ptr> &ptr) : _child_handle(std::move(ch)), _exit_status(ptr) {} - explicit child(child_handle &&ch) : _child_handle(std::move(ch)) {} - explicit child(pid_t & pid) : _child_handle(pid) {}; - child(const child&) = delete; - child(child && lhs) - : _child_handle(std::move(lhs._child_handle)), - _exit_status(std::move(lhs._exit_status)), - _attached (lhs._attached) - { - lhs._attached = false; - } - - child() = default; - child& operator=(const child&) = delete; - child& operator=(child && lhs) - { - _child_handle= std::move(lhs._child_handle); - _exit_status = std::move(lhs._exit_status); - _attached = lhs._attached; - lhs._attached = false; - return *this; - }; - - void detach() {_attached = false; } - void join() {wait();} - bool joinable() { return _attached;} - - ~child() - { - if (_attached && !_exited() && running()) - terminate(); - } - native_handle_t native_handle() const { return _child_handle.process_handle(); } + child c(std::forward(args)...); + c.detach(); +} - int exit_code() const {return _exit_status->load();} - pid_t id() const {return _child_handle.id(); } +template +inline int system(Args && ...args) +{ + child c(std::forward(args)...); + c.wait(); + return c.exit_code(); +} - bool running() - { - if (valid() && !_exited()) - { - int code; - auto res = boost::process::detail::api::is_running(_child_handle, code); - if (!res && !_exited()) - _exit_status->store(code); - return res; - } - return false; - } - - void terminate() - { - if (valid()) - boost::process::detail::api::terminate(_child_handle); - - _terminated = true; - } - - void wait() - { - if (!_exited() && valid()) - { - int exit_code = 0; - boost::process::detail::api::wait(_child_handle, exit_code); - _exit_status->store(exit_code); - } - } - - template< class Rep, class Period > - bool wait_for (const std::chrono::duration& rel_time) - { - if (!_exited()) - { - int exit_code = 0; - auto b = boost::process::detail::api::wait_for(_child_handle, exit_code, rel_time); - if (!b) - return false; - _exit_status->store(exit_code); - } - return true; - } - - template< class Clock, class Duration > - bool wait_until(const std::chrono::time_point& timeout_time ) - { - if (!_exited()) - { - int exit_code = 0; - auto b = boost::process::detail::api::wait_until(_child_handle, exit_code, timeout_time); - if (!b) - return false; - _exit_status->store(exit_code); - } - return true; - } - - bool valid() const - { - return _child_handle.valid(); - } - operator bool() const {return valid();} - - bool in_group() const - { - return _child_handle.in_group(); - } - bool in_group(std::error_code &ec) const - { - return _child_handle.in_group(ec); - } -}; }} #endif diff --git a/include/boost/process/detail/executor.hpp b/include/boost/process/detail/executor.hpp deleted file mode 100644 index f6b390af..00000000 --- a/include/boost/process/detail/executor.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2006, 2007 Julio M. Merino Vidal -// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling -// Copyright (c) 2009 Boris Schaeling -// Copyright (c) 2010 Felipe Tanus, Boris Schaeling -// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -/** - * \file boost/process/executor.hpp - * - * Defines an executor which can create child processes. - */ - -#ifndef BOOST_PROCESS_EXECUTOR_HPP -#define BOOST_PROCESS_EXECUTOR_HPP - -#include - -#if defined( BOOST_POSIX_API ) -#include -#elif defined( BOOST_WINDOWS_API ) -#include -#endif - - -#endif diff --git a/include/boost/process/detail/windows/executor.hpp b/include/boost/process/detail/windows/executor.hpp index e427ca0c..9bbe4529 100644 --- a/include/boost/process/detail/windows/executor.hpp +++ b/include/boost/process/detail/windows/executor.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_PROCESS_WINDOWS_EXECUTOR_HPP #define BOOST_PROCESS_WINDOWS_EXECUTOR_HPP -#include +#include #include #include #include @@ -25,7 +25,9 @@ #include -namespace boost { namespace process { namespace detail { namespace windows { +namespace boost { namespace process { + +namespace detail { namespace windows { template struct startup_info; #if !defined( BOOST_NO_ANSI_APIS ) diff --git a/include/boost/process/execute.hpp b/include/boost/process/execute.hpp deleted file mode 100644 index 05343348..00000000 --- a/include/boost/process/execute.hpp +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) 2006, 2007 Julio M. Merino Vidal -// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling -// Copyright (c) 2009 Boris Schaeling -// Copyright (c) 2010 Felipe Tanus, Boris Schaeling -// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling -// Copyright (c) 2016 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -/** - * \file boost/process/execute.hpp - * - * Defines a function to execute a program. - */ - -#ifndef BOOST_PROCESS_EXECUTE_HPP -#define BOOST_PROCESS_EXECUTE_HPP - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - -namespace boost { namespace process { - -namespace detail { - -template -struct make_builders_from_view -{ - typedef boost::fusion::set set; - typedef typename boost::fusion::result_of::deref::type ref_type; - typedef typename std::remove_reference::type res_type; - typedef typename initializer_tag::type tag; - typedef typename initializer_builder::type builder_type; - typedef typename boost::fusion::result_of::has_key has_key; - - typedef typename boost::fusion::result_of::next::type next_itr; - typedef typename make_builders_from_view::type next; - - typedef typename - std::conditional::type, - typename make_builders_from_view::type - >::type type; - -}; - -template -struct make_builders_from_view -{ - typedef boost::fusion::set type; -}; - -template -struct builder_ref -{ - Builders &builders; - builder_ref(Builders & builders) : builders(builders) {}; - - template - void operator()(T && value) const - { - typedef typename initializer_tag::type>::type tag; - typedef typename initializer_builder::type builder_type; - boost::fusion::at_key(builders)(std::forward(value)); - } -}; - -template -struct get_initializers_result -{ - typedef typename T::result_type type; -}; - -template<> -struct get_initializers_result -{ - typedef boost::fusion::void_ type; -}; - -template -struct helper_vector -{ - -}; - -template -struct invoke_get_initializer_collect_keys; - -template -struct invoke_get_initializer_collect_keys, Stack...> -{ - typedef helper_vector type; -}; - - -template -struct invoke_get_initializer_collect_keys, Stack...> -{ - typedef typename invoke_get_initializer_collect_keys, Stack..., First>::type next; - typedef helper_vector stack_t; - - typedef typename std::conditional::value, - stack_t, next>::type type; - - -}; - - -template -struct invoke_get_initializer; - -template -struct invoke_get_initializer> - -{ - typedef boost::fusion::tuple::type...> result_type; - - template - static result_type call(Sequence & seq) - { - return result_type(boost::fusion::at_key(seq).get_initializer()...);; - } -}; - - - - - -template -boost::fusion::tuple::type...> - get_initializers(boost::fusion::set & builders) -{ - //typedef boost::fusion::tuple::type...> return_type; - typedef typename invoke_get_initializer_collect_keys>::type keys; - return invoke_get_initializer::call(builders); -} - - - -} - -template -inline child execute(Args&& ... args) -{ - //create a tuple from the argument list - boost::fusion::tuple::type&...> tup(args...); - - auto inits = boost::fusion::filter_if< - boost::process::detail::is_initializer< - typename std::remove_reference< - boost::mpl::_ - >::type - > - >(tup); - - auto others = boost::fusion::filter_if< - boost::mpl::not_< - boost::process::detail::is_initializer< - typename std::remove_reference< - boost::mpl::_ - >::type - > - > - >(tup); - - // typename detail::make_builders_from_view::type builders; - - //typedef typename boost::fusion::result_of::as_vector::type inits_t; - typedef typename boost::fusion::result_of::as_vector::type others_t; - // typedef decltype(others) others_t; - typedef typename detail::make_builders_from_view< - typename boost::fusion::result_of::begin::type, - typename boost::fusion::result_of::end ::type>::type builder_t; - - builder_t builders; - detail::builder_ref builder_ref(builders); - - boost::fusion::for_each(others, builder_ref); - - auto other_inits = ::boost::process::detail::get_initializers(builders); - - - boost::fusion::joint_view complete_inits(other_inits, inits); - - auto exec = boost::process::detail::api::make_executor(complete_inits); - return exec(); -} - -}} - -#endif diff --git a/test/async.cpp b/test/async.cpp index 50b5b64a..19466ff0 100644 --- a/test/async.cpp +++ b/test/async.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include @@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(async_wait) bool exit_called = false; int exit_code = 0; std::error_code ec; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--exit-code", "123", ec, @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(async_out_stream) boost::asio::streambuf buf; - auto c = bp::execute(master_test_suite().argv[1], + bp::child c(master_test_suite().argv[1], "test", "--echo-stdout", "abc", bp::std_out > buf, io_service, @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(async_in_stream) std::ostream ostr(&in_buf); ostr << "-string" << endl ; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--prefix-once", "test", bp::std_in < in_buf, diff --git a/test/bind_stderr.cpp b/test/bind_stderr.cpp index a47b5767..a6fb99ef 100644 --- a/test/bind_stderr.cpp +++ b/test/bind_stderr.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include @@ -46,7 +45,7 @@ BOOST_AUTO_TEST_CASE(sync_io, *boost::unit_test::timeout(2)) bp::ipstream is; std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args={"test", "--echo-stderr", "hello"}, bp::std_err>is, @@ -82,7 +81,7 @@ BOOST_AUTO_TEST_CASE(async_io, *boost::unit_test::timeout(2)) bp::async_pipe p(io_service); std::error_code ec; - auto c = bp::execute( + bp::child c( bp::exe=master_test_suite().argv[1], bp::args+="test", bp::args+={"--echo-stderr", "abc"}, @@ -102,7 +101,7 @@ BOOST_AUTO_TEST_CASE(nul, *boost::unit_test::timeout(2)) { using boost::unit_test::framework::master_test_suite; std::error_code ec; - bp::child c = bp::execute( + bp::child c( bp::exe(master_test_suite().argv[1]), bp::args+={"test", "--is-nul-stderr"}, bp::std_err>bp::null, diff --git a/test/bind_stdin.cpp b/test/bind_stdin.cpp index b9392b6b..41cac6b4 100644 --- a/test/bind_stdin.cpp +++ b/test/bind_stdin.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -49,7 +48,7 @@ BOOST_AUTO_TEST_CASE(sync_io, *boost::unit_test::timeout(2)) std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args+={"test", "--prefix", "abc"}, bp::std_in #include #include -#include #include #include @@ -35,7 +34,7 @@ BOOST_AUTO_TEST_CASE(sync_io, *boost::unit_test::timeout(5)) bp::pipe p2; std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args+={"test", "--stdin-to-stdout"}, bp::std_in #include #include -#include #include #include @@ -44,7 +43,7 @@ BOOST_AUTO_TEST_CASE(sync_io, *boost::unit_test::timeout(5)) bp::ipstream is; std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args+={"test", "--echo-stdout", "hello"}, bp::std_out > is, @@ -88,7 +87,7 @@ BOOST_AUTO_TEST_CASE(async_io, *boost::unit_test::timeout(2)) bp::async_pipe p(io_service); std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--echo-stdout", "abc", bp::std_out > p, @@ -109,7 +108,7 @@ BOOST_AUTO_TEST_CASE(nul, *boost::unit_test::timeout(2)) std::error_code ec; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args+={"test", "--is-nul-stdout"}, bp::std_out>bp::null, diff --git a/test/bind_stdout_stderr.cpp b/test/bind_stdout_stderr.cpp index 5a11ac9d..06b99957 100644 --- a/test/bind_stdout_stderr.cpp +++ b/test/bind_stdout_stderr.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -46,7 +45,7 @@ BOOST_AUTO_TEST_CASE(sync_io, *boost::unit_test::timeout(2)) bp::ipstream is2; std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--echo-stdout-stderr", "hello", bp::std_out>is1, @@ -91,7 +90,7 @@ BOOST_AUTO_TEST_CASE(async_io, *boost::unit_test::timeout(2)) bp::async_pipe p2(io_service); std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args={"test", "--echo-stdout-stderr", "abc"}, bp::std_out > p1, @@ -115,7 +114,7 @@ BOOST_AUTO_TEST_CASE(nul, *boost::unit_test::timeout(2)) { using boost::unit_test::framework::master_test_suite; std::error_code ec; - bp::child c = bp::execute( + bp::child c( bp::exe(master_test_suite().argv[1]), bp::args+={"test", "--echo-stdout-stderr", "some string"}, (bp::std_err & bp::std_out) > bp::null, diff --git a/test/close_stderr.cpp b/test/close_stderr.cpp index 8fb5db07..42032eaf 100644 --- a/test/close_stderr.cpp +++ b/test/close_stderr.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -31,7 +30,7 @@ BOOST_AUTO_TEST_CASE(closed) using boost::unit_test::framework::master_test_suite; std::error_code ec; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--is-closed-stderr", bp::std_err > bp::close, diff --git a/test/close_stdin.cpp b/test/close_stdin.cpp index 1110166c..4305d115 100644 --- a/test/close_stdin.cpp +++ b/test/close_stdin.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -30,7 +29,7 @@ BOOST_AUTO_TEST_CASE(closed) using boost::unit_test::framework::master_test_suite; std::error_code ec; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--is-closed-stdin", bp::std_in.close(), diff --git a/test/close_stdout.cpp b/test/close_stdout.cpp index c6fbb512..52cade4e 100644 --- a/test/close_stdout.cpp +++ b/test/close_stdout.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -30,7 +29,7 @@ BOOST_AUTO_TEST_CASE(closed) using boost::unit_test::framework::master_test_suite; std::error_code ec; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--is-closed-stdout", bp::std_out.close(), diff --git a/test/env.cpp b/test/env.cpp index 22e6edfd..84915f08 100644 --- a/test/env.cpp +++ b/test/env.cpp @@ -14,8 +14,8 @@ #include #include #include +#include #include -#include #include @@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(inherit_env, *boost::unit_test::timeout(2)) std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--query ", "PATH", bp::std_out>st, @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(inherit_mod_env, *boost::unit_test::timeout(2)) bp::ipstream st; std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--query", "BOOST_PROCESS_TEST_1", bp::std_out>st, @@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE(modifided_env, *boost::unit_test::timeout(2)) std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--query", "BOOST_PROCESS_TEST_2", bp::std_out>st, diff --git a/test/exit_code.cpp b/test/exit_code.cpp index 2879d62e..14bc895c 100644 --- a/test/exit_code.cpp +++ b/test/exit_code.cpp @@ -12,8 +12,8 @@ #include #include -#include #include +#include #include #include @@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(sync_wait) using boost::unit_test::framework::master_test_suite; std::error_code ec; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--exit-code", "123", ec @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(async_wait) #endif std::error_code ec; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--exit-code", "123", ec diff --git a/test/extensions.cpp b/test/extensions.cpp index f04a0926..95f4c9aa 100644 --- a/test/extensions.cpp +++ b/test/extensions.cpp @@ -10,12 +10,11 @@ #define BOOST_TEST_MAIN #define BOOST_TEST_IGNORE_SIGCHLD #include -#include #include #include #include #include - +#include namespace bp = boost::process; @@ -52,7 +51,7 @@ BOOST_AUTO_TEST_CASE(extensions) set_on_error se; std::error_code ec; - bp::execute( + bp::child c( "Wrong-Command", "test", bp::on_setup=re, diff --git a/test/group.cpp b/test/group.cpp index c335f3ae..a7ad54d9 100644 --- a/test/group.cpp +++ b/test/group.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -49,7 +48,7 @@ BOOST_AUTO_TEST_CASE(group_test, *boost::unit_test::timeout(5)) bp::group g; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], g, ec @@ -78,7 +77,7 @@ BOOST_AUTO_TEST_CASE(attached, *boost::unit_test::timeout(5)) bp::group g; std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args+={"--launch-attached"}, bp::std_out>is, @@ -143,7 +142,7 @@ BOOST_AUTO_TEST_CASE(detached, *boost::unit_test::timeout(5)) std::error_code ec; - auto c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args+={"--launch-detached"}, bp::std_out>is, diff --git a/test/posix_specific.cpp b/test/posix_specific.cpp index b83d045d..7065353e 100644 --- a/test/posix_specific.cpp +++ b/test/posix_specific.cpp @@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(bind_fd, *boost::unit_test::timeout(2)) bp::child c; { std::error_code ec; - c = bp::execute( + bp::child c( master_test_suite().argv[1], "test", "--posix-echo-one", "3", "hello", bp::posix::fd.bind(3, p.native_sink()), diff --git a/test/run_exe.cpp b/test/run_exe.cpp index 90f64bd6..b9889dd7 100644 --- a/test/run_exe.cpp +++ b/test/run_exe.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include namespace bp = boost::process; @@ -22,19 +22,19 @@ int main(int argc, char* argv[]) std::error_code ec; BOOST_TEST(!ec); - auto c = bp::execute(argv[1], ec); + bp::child c(argv[1], ec); BOOST_TEST(!ec); if (ec) std::cerr << ec.message() << std::endl; - auto c2 = bp::execute("doesnt-exist", ec); + auto c2 = bp::child("doesnt-exist", ec); BOOST_TEST(ec); try { - auto c = bp::execute("doesnt-exist"); + bp::child c("doesnt-exist"); BOOST_TEST(false); } catch(std::system_error & se) diff --git a/test/run_exe_path.cpp b/test/run_exe_path.cpp index 269f2f53..118fda7d 100644 --- a/test/run_exe_path.cpp +++ b/test/run_exe_path.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include namespace bp = boost::process; @@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(run_exe_success) boost::filesystem::path exe = master_test_suite().argv[1]; std::error_code ec; - bp::execute( + bp::child c( exe, ec ); @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(run_exe_error) boost::filesystem::path exe = "doesnt-exist"; std::error_code ec; - bp::execute( + bp::child c( exe, ec ); diff --git a/test/show_window.cpp b/test/show_window.cpp index b5665fa1..11380400 100644 --- a/test/show_window.cpp +++ b/test/show_window.cpp @@ -23,19 +23,16 @@ BOOST_AUTO_TEST_CASE(show_window) using boost::unit_test::framework::master_test_suite; bp::ipstream is; - bp::child c; - { - std::error_code ec; - c = bp::execute( - master_test_suite().argv[1], - "test", "--windows-print-showwindow", - bp::show_normal, - bp::std_out>is, - ec - ); - BOOST_REQUIRE(!ec); - } + std::error_code ec; + bp::child c( + master_test_suite().argv[1], + "test", "--windows-print-showwindow", + bp::show_normal, + bp::std_out>is, + ec + ); + BOOST_REQUIRE(!ec); int i; is >> i; diff --git a/test/start_dir.cpp b/test/start_dir.cpp index 0bbaa4e9..706c511c 100644 --- a/test/start_dir.cpp +++ b/test/start_dir.cpp @@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE(start_in_dir) bp::ipstream is; std::error_code ec; - bp::child c = bp::execute( + bp::child c( bp::exe=boost::filesystem::absolute(master_test_suite().argv[1]).string(), bp::args +={"test", "--pwd"}, bp::start_dir = dir.s_, diff --git a/test/sub_launcher.cpp b/test/sub_launcher.cpp index 194532a5..d7ac59f6 100644 --- a/test/sub_launcher.cpp +++ b/test/sub_launcher.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) if (launch_attached) { - c1 = execute(argv[0], ec, std_out > null, std_err > null, std_in < null); + c1 = child(argv[0], ec, std_out > null, std_err > null, std_in < null); if (ec) { cout << -1 << endl; @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) { group g; - c2 = execute(argv[0], ec, g, std_out > null, std_err > null, std_in < null); + c2 = child(argv[0], ec, g, std_out > null, std_err > null, std_in < null); if (ec) { cout << -1 << endl; diff --git a/test/terminate.cpp b/test/terminate.cpp index c2dd7ffe..f0c1fc85 100644 --- a/test/terminate.cpp +++ b/test/terminate.cpp @@ -11,8 +11,8 @@ #define BOOST_TEST_IGNORE_SIGCHLD #include #include -#include #include +#include #include #include #include @@ -24,7 +24,7 @@ BOOST_AUTO_TEST_CASE(terminate_set_on_error) using boost::unit_test::framework::master_test_suite; std::error_code ec; - bp::child c = bp::execute( + bp::child c( bp::exe(master_test_suite().argv[1]), bp::args+={"test", "--loop"}, ec @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(terminate_throw_on_error) using boost::unit_test::framework::master_test_suite; std::error_code ec; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args+="test", bp::args+="--loop", diff --git a/test/throw_on_error.cpp b/test/throw_on_error.cpp index 0e25885d..a9ed0ad7 100644 --- a/test/throw_on_error.cpp +++ b/test/throw_on_error.cpp @@ -19,7 +19,7 @@ int main(int argc, char* argv[]) { bool thrown = false; try { - bp::execute( + bp::child c( bp::cmd="doesnt-exist", bp::throw_on_error ); diff --git a/test/wait.cpp b/test/wait.cpp index 02a54749..9a790d9d 100644 --- a/test/wait.cpp +++ b/test/wait.cpp @@ -11,7 +11,7 @@ #define BOOST_TEST_IGNORE_SIGCHLD #include #include -#include +#include #include #include #include @@ -27,7 +27,7 @@ BOOST_AUTO_TEST_CASE(sync_wait) using boost::unit_test::framework::master_test_suite; std::error_code ec; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args+={"test", "--wait", "1"}, ec @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE(async_wait) std::error_code ec; bool called = false; - bp::child c = bp::execute( + bp::child c( master_test_suite().argv[1], bp::args+={"test", "--wait", "1"}, ec,