2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-20 04:42:24 +00:00

Compare commits

..

10 Commits

Author SHA1 Message Date
Klemens Morgenstern
981fdf18bf Reverted 2fc71ca0 after asio update. 2022-12-13 09:14:25 +08:00
Klemens Morgenstern
ae778f36a8 Include fixes. 2022-11-11 11:14:46 +08:00
Sam Darwin
0671e4a133 Drone: update freebsd jobs (#274) 2022-11-01 10:40:04 +08:00
Klemens Morgenstern
cbf944c57b using scope-exit limit group_wait. 2022-11-01 03:08:12 +08:00
Klemens Morgenstern
5f2b8c53f4 Disabled limit_fd for freebsd. 2022-11-01 02:58:31 +08:00
Klemens Morgenstern
dac3614a38 group wait test on_scope exit fix. 2022-10-31 12:25:30 +08:00
Klemens Morgenstern
2fc71ca0a3 Disabled pdfork by default, bc of asio errors. 2022-10-31 11:23:49 +08:00
Klemens Morgenstern
404682d75d Increased timeout for sporadically failing test. 2022-10-31 11:21:48 +08:00
Klemens Morgenstern
9fbbdc3421 Merge pull request #276 from Flamefire/patch-1
Update .drone.star
2022-10-23 11:21:09 +08:00
Alexander Grund
3df0009a2f Update .drone.star
Remove the `image` param which is superflous, misleading and may become an error. See https://github.com/boostorg/boost-ci/pull/189

[skip ci]
2022-10-22 11:26:04 +02:00
8 changed files with 18 additions and 22 deletions

View File

@@ -19,6 +19,7 @@
#include <filesystem>
#include <string_view>
#include <iomanip>
#include <optional>
#if defined(ASIO_WINDOWS)
#define BOOST_PROCESS_V2_WINDOWS 1
@@ -51,6 +52,7 @@
#include <boost/system/error_code.hpp>
#include <boost/system/system_category.hpp>
#include <boost/system/system_error.hpp>
#include <boost/optional.hpp>
#if defined(BOOST_WINDOWS_API)
#define BOOST_PROCESS_V2_WINDOWS 1
@@ -72,11 +74,9 @@
#if defined(BOOST_PROCESS_USE_STD_FS)
#include <filesystem>
#include <optional>
#else
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/optional.hpp>
#endif
#define BOOST_PROCESS_V2_BEGIN_NAMESPACE namespace boost { namespace process { namespace v2 {

View File

@@ -153,12 +153,9 @@ struct basic_process_handle_fd_or_signal
void wait(native_exit_code_type &exit_status, error_code &ec)
{
if (pid_ <= 0)
return;
int res = 0;
while ((res = ::waitpid(pid_, &exit_status, 0)) < 0)
while (::waitpid(pid_, &exit_status, 0) < 0)
{
if (errno != EINTR)
{
@@ -166,6 +163,7 @@ struct basic_process_handle_fd_or_signal
break;
}
}
}
void wait(native_exit_code_type &exit_status)
@@ -288,37 +286,31 @@ struct basic_process_handle_fd_or_signal
struct async_wait_op_
{
BOOST_PROCESS_V2_ASIO_NAMESPACE::posix::basic_stream_descriptor<Executor> &descriptor;
BOOST_PROCESS_V2_ASIO_NAMESPACE::posix::basic_descriptor<Executor> &descriptor;
BOOST_PROCESS_V2_ASIO_NAMESPACE::basic_signal_set<Executor> &handle;
pid_type pid_;
bool needs_post = true;
template<typename Self>
void operator()(Self &&self, error_code ec = {}, int res = 0)
void operator()(Self &&self, error_code ec = {}, int = 0)
{
printf("RES : %d -> %s\n", res, ec.message().c_str());
native_exit_code_type exit_code = -1;
native_exit_code_type exit_code{};
int wait_res = -1;
if (pid_ <= 0) // error, complete early
ec = BOOST_PROCESS_V2_ASIO_NAMESPACE::error::bad_descriptor;
else
{
printf("test in %d\n", errno);
wait_res = ::waitpid(pid_, &exit_code, WNOHANG);
if (wait_res == -1)
ec = get_last_error();
else
ec.clear();
}
if (!ec && (wait_res == 0))
{
needs_post = false;
static int res[1] = {0};
if (descriptor.is_open())
descriptor.async_wait(
BOOST_PROCESS_V2_ASIO_NAMESPACE::posix::stream_descriptor::wait_read,
BOOST_PROCESS_V2_ASIO_NAMESPACE::posix::descriptor_base::wait_read,
std::move(self));
else
handle.async_wait(std::move(self));

View File

@@ -94,6 +94,7 @@ struct bind_fd
error_code on_setup(posix::default_launcher & launcher, const filesystem::path &, const char * const *)
{
launcher.fd_whitelist.push_back(target);
return {};
}
/// Implementation of the initialization function.

View File

@@ -11,6 +11,7 @@
#define BOOST_PROCESS_v2_START_DIR_HPP
#include <boost/process/v2/detail/config.hpp>
#include <boost/process/v2/detail/last_error.hpp>
#include <boost/process/v2/default_launcher.hpp>
BOOST_PROCESS_V2_BEGIN_NAMESPACE

View File

@@ -11,6 +11,7 @@
#define BOOST_PROCESS_V2_STDIO_HPP
#include <boost/process/v2/detail/config.hpp>
#include <boost/process/v2/detail/last_error.hpp>
#include <boost/process/v2/default_launcher.hpp>
#include <cstddef>
#if defined(BOOST_PROCESS_V2_STANDALONE)

View File

@@ -101,7 +101,7 @@ test-suite with-valgrind :
[ run group.cpp system thread filesystem : [ test-options group ] : sub_launch ]
[ run group.cpp system thread filesystem : [ test-options group ] : sub_launch : <build>no <target-os>windows:<build>yes <define>BOOST_USE_WINDOWS_H=1 : group-windows-h ]
[ run group_wait.cpp system thread filesystem : [ test-options group_wait ] : sparring_partner : <target-os>darwin:<build>no ]
[ run limit_fd.cpp program_options system filesystem : [ test-options limit_fd ] : sparring_partner ]
[ run limit_fd.cpp program_options system filesystem : [ test-options limit_fd ] : sparring_partner : <target-os>freebsd:<build>no ]
[ run run_exe.cpp filesystem : : sparring_partner ]
[ run run_exe_path.cpp filesystem : [ test-options run_exe_path ] : sparring_partner ]
[ run search_path.cpp filesystem system : [ test-options search_path ] : : <target-os>windows:<source>shell32 ]

View File

@@ -16,7 +16,7 @@
#include <boost/asio.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/scope_exit.hpp>
#include <boost/process/error.hpp>
#include <boost/process/io.hpp>
#include <boost/process/args.hpp>
@@ -45,6 +45,10 @@ BOOST_AUTO_TEST_CASE(wait_group_test, *boost::unit_test::timeout(5))
BOOST_REQUIRE(done.load());
}};
BOOST_SCOPE_EXIT_ALL(&) {
done.store(true);
thr.join();
};
using boost::unit_test::framework::master_test_suite;
@@ -78,9 +82,6 @@ BOOST_AUTO_TEST_CASE(wait_group_test, *boost::unit_test::timeout(5))
BOOST_CHECK(!c1.running());
BOOST_CHECK(!c2.running());
done.store(true);
thr.join();
}

View File

@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(wait_for)
BOOST_CHECK(!c.wait_for(std::chrono::milliseconds(200)));
BOOST_CHECK( c.wait_for(std::chrono::milliseconds(1000)));
BOOST_CHECK( c.wait_for(std::chrono::milliseconds(2000)));
auto timeout_t = std::chrono::system_clock::now();