Merge remote-tracking branch 'origin/master'

This commit is contained in:
Yukino Song
2024-12-02 02:11:15 +08:00
45 changed files with 983 additions and 498 deletions

View File

@@ -110,7 +110,8 @@ namespace proc {
// We always call terminate() even if we waited successfully for all processes above.
// This ensures the process group state is consistent with the OS in boost.
group.terminate();
std::error_code ec;
group.terminate(ec);
group.detach();
}
@@ -462,6 +463,16 @@ namespace proc {
int
proc_t::running() {
#ifndef _WIN32
// On POSIX OSes, we must periodically wait for our children to avoid
// them becoming zombies. This must be synchronized carefully with
// calls to bp::wait() and platf::process_group_running() which both
// invoke waitpid() under the hood.
auto reaper = util::fail_guard([]() {
while (waitpid(-1, nullptr, WNOHANG) > 0);
});
#endif
if (placebo) {
return _app_id;
}