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

Compare commits

..

1 Commits

Author SHA1 Message Date
Klemens Morgenstern
c8179a99e0 Checking waitpid res for zombie process reaping.
Fixes comment by @mathisloge in issue #447.
2025-05-24 09:38:36 +08:00
5 changed files with 9 additions and 5 deletions

View File

@@ -411,7 +411,8 @@ struct default_launcher
if (ec)
{
detail::on_error(*this, executable, argv, ec, inits...);
do { ::waitpid(pid, nullptr, 0); } while (errno == EINTR);
int res = 0;
do { res = ::waitpid(pid, nullptr, 0); } while ((res == -1) && (errno == EINTR));
return basic_process<Executor>{exec};
}
}

View File

@@ -124,7 +124,8 @@ struct fork_and_forget_launcher : default_launcher
if (ec)
{
detail::on_error(*this, executable, argv, ec, inits...);
do { ::waitpid(pid, nullptr, 0); } while (errno == EINTR);
int res = 0;
do { res = ::waitpid(pid, nullptr, 0); } while ((res != -1) && (errno == EINTR));
return basic_process<Executor>{exec};
}
}

View File

@@ -161,7 +161,8 @@ struct pdfork_launcher : default_launcher
if (ec)
{
detail::on_error(*this, executable, argv, ec, inits...);
do { ::waitpid(pid, nullptr, 0); } while (errno == EINTR);
int res = 0;
do { res = ::waitpid(pid, nullptr, 0); } while ((res == -1) && (errno == EINTR));
return basic_process<Executor>{exec};
}
}

View File

@@ -121,7 +121,8 @@ struct vfork_launcher : default_launcher
if (ec)
{
detail::on_error(*this, executable, argv, ec, inits...);
do { ::waitpid(pid, nullptr, 0); } while (errno == EINTR);
int res = 0;
do { res = ::waitpid(pid, nullptr, 0); } while ((res != -1) && (errno == EINTR));
return basic_process<Executor>{exec};
}

View File

@@ -109,7 +109,7 @@ inline std::false_type probe_on_error(
template<typename Launcher, typename Init>
inline auto probe_on_error(Launcher & launcher, Init && init, derived && )
-> std::is_same<error_code, decltype(init.on_error(launcher, std::declval<const filesystem::path &>(), std::declval<std::wstring &>(), std::declval<error_code&>()))>;
-> std::is_same<error_code, decltype(init.on_error(launcher, std::declval<const filesystem::path &>(), std::declval<std::wstring &>(), std::declval<std::error_code&>()))>;
template<typename Launcher, typename Init>
using has_on_error = decltype(probe_on_error(std::declval<Launcher&>(), std::declval<Init>(), derived{}));