fix fork()
This commit is contained in:
@@ -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 {};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user