mirror of
https://github.com/boostorg/process.git
synced 2026-01-19 04:22:15 +00:00
@@ -383,11 +383,15 @@ struct default_launcher
|
||||
|
||||
auto & ctx = net::query(
|
||||
exec, net::execution::context);
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_prepare);
|
||||
#endif
|
||||
pid = ::fork();
|
||||
if (pid == -1)
|
||||
{
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_parent);
|
||||
#endif
|
||||
detail::on_fork_error(*this, executable, argv, ec, inits...);
|
||||
detail::on_error(*this, executable, argv, ec, inits...);
|
||||
|
||||
@@ -397,7 +401,9 @@ struct default_launcher
|
||||
else if (pid == 0)
|
||||
{
|
||||
::close(pg.p[0]);
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_child);
|
||||
#endif
|
||||
ec = detail::on_exec_setup(*this, executable, argv, inits...);
|
||||
if (!ec)
|
||||
{
|
||||
@@ -412,8 +418,9 @@ struct default_launcher
|
||||
::exit(EXIT_FAILURE);
|
||||
return basic_process<Executor>{exec};
|
||||
}
|
||||
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_parent);
|
||||
#endif
|
||||
::close(pg.p[1]);
|
||||
pg.p[1] = -1;
|
||||
int child_error{0};
|
||||
|
||||
@@ -86,11 +86,16 @@ struct fork_and_forget_launcher : default_launcher
|
||||
|
||||
auto & ctx = net::query(
|
||||
exec, net::execution::context);
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_prepare);
|
||||
#endif
|
||||
pid = ::fork();
|
||||
if (pid == -1)
|
||||
{
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_parent);
|
||||
#endif
|
||||
detail::on_fork_error(*this, executable, argv, ec, inits...);
|
||||
detail::on_fork_error(*this, executable, argv, ec, inits...);
|
||||
detail::on_error(*this, executable, argv, ec, inits...);
|
||||
|
||||
@@ -99,8 +104,9 @@ struct fork_and_forget_launcher : default_launcher
|
||||
}
|
||||
else if (pid == 0)
|
||||
{
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_child);
|
||||
|
||||
#endif
|
||||
ec = detail::on_exec_setup(*this, executable, argv, inits...);
|
||||
if (!ec)
|
||||
close_all_fds(ec);
|
||||
@@ -112,7 +118,9 @@ struct fork_and_forget_launcher : default_launcher
|
||||
::exit(EXIT_FAILURE);
|
||||
return basic_process<Executor>{exec};
|
||||
}
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_parent);
|
||||
#endif
|
||||
if (ec)
|
||||
{
|
||||
detail::on_error(*this, executable, argv, ec, inits...);
|
||||
|
||||
@@ -103,11 +103,15 @@ struct pdfork_launcher : default_launcher
|
||||
|
||||
auto & ctx = net::query(
|
||||
exec, net::execution::context);
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_prepare);
|
||||
#endif
|
||||
pid = ::pdfork(&fd, PD_DAEMON | PD_CLOEXEC);
|
||||
if (pid == -1)
|
||||
{
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_parent);
|
||||
#endif
|
||||
detail::on_fork_error(*this, executable, argv, ec, inits...);
|
||||
detail::on_error(*this, executable, argv, ec, inits...);
|
||||
|
||||
@@ -116,7 +120,9 @@ struct pdfork_launcher : default_launcher
|
||||
}
|
||||
else if (pid == 0)
|
||||
{
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_child);
|
||||
#endif
|
||||
::close(pg.p[0]);
|
||||
|
||||
ec = detail::on_exec_setup(*this, executable, argv, inits...);
|
||||
@@ -133,7 +139,9 @@ struct pdfork_launcher : default_launcher
|
||||
::exit(EXIT_FAILURE);
|
||||
return basic_process<Executor>{exec};
|
||||
}
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_parent);
|
||||
#endif
|
||||
::close(pg.p[1]);
|
||||
pg.p[1] = -1;
|
||||
int child_error{0};
|
||||
|
||||
@@ -86,13 +86,16 @@ struct vfork_launcher : default_launcher
|
||||
return basic_process<Executor>(exec);
|
||||
}
|
||||
|
||||
auto & ctx = net::query(
|
||||
exec, net::execution::context);
|
||||
auto & ctx = net::query(exec, net::execution::context);
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_prepare);
|
||||
#endif
|
||||
pid = ::vfork();
|
||||
if (pid == -1)
|
||||
{
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_parent);
|
||||
#endif
|
||||
detail::on_fork_error(*this, executable, argv, ec, inits...);
|
||||
detail::on_error(*this, executable, argv, ec, inits...);
|
||||
|
||||
@@ -112,8 +115,9 @@ struct vfork_launcher : default_launcher
|
||||
::_exit(EXIT_FAILURE);
|
||||
return basic_process<Executor>{exec};
|
||||
}
|
||||
#if !defined(BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK)
|
||||
ctx.notify_fork(net::execution_context::fork_parent);
|
||||
|
||||
#endif
|
||||
if (ec)
|
||||
{
|
||||
detail::on_error(*this, executable, argv, ec, inits...);
|
||||
|
||||
Reference in New Issue
Block a user