fix fork()
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/pr-master This commit looks good

This commit is contained in:
2025-07-24 19:41:00 -05:00
parent 3b91b5b8d6
commit ff6d698a5f

View File

@@ -721,7 +721,7 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
args.insert(std::next(args.begin(), 4U), "/MIN");
args.insert(std::next(args.begin(), 5U), repertory_binary_);
#else // !defined(_WIN32)
args.insert(std::next(args.begin()), "-f");
args.insert(args.begin(), "-f");
args.insert(args.begin(), repertory_binary_);
#endif // defined(_WIN32)
@@ -742,10 +742,11 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
}
if (pid == 0) {
signal(SIGCHLD, SIG_DFL);
if (setsid() < 0) {
exit(1);
}
chdir("/");
close(STDIN_FILENO);
close(STDOUT_FILENO);
@@ -757,12 +758,14 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
exit(1);
}
chdir(utils::path::get_parent_path(repertory_binary_).c_str());
execvp(exec_args.at(0U), const_cast<char *const *>(exec_args.data()));
exit(1);
} else {
signal(SIGCHLD, SIG_IGN);
}
#endif // defined(_WIN32)
return {};
}