Use a dummy function for SIGPIPE instead of SIG_IGN

SIG_IGN is inherited after 'execve' and requires us to reset
that signal handler, which does not work well with vfork on
OSX. Using an empty function does the trick and will be auto
reset to default on exec.
This commit is contained in:
Maxime Coste 2018-12-06 20:33:13 +11:00
parent 5f315e68b6
commit b897a18aa6
2 changed files with 1 additions and 2 deletions

View File

@ -912,7 +912,7 @@ int main(int argc, char* argv[])
set_signal_handler(SIGFPE, signal_handler); set_signal_handler(SIGFPE, signal_handler);
set_signal_handler(SIGQUIT, signal_handler); set_signal_handler(SIGQUIT, signal_handler);
set_signal_handler(SIGTERM, signal_handler); set_signal_handler(SIGTERM, signal_handler);
set_signal_handler(SIGPIPE, SIG_IGN); set_signal_handler(SIGPIPE, [](int){});
set_signal_handler(SIGINT, [](int){}); set_signal_handler(SIGINT, [](int){});
set_signal_handler(SIGCHLD, [](int){}); set_signal_handler(SIGCHLD, [](int){});

View File

@ -177,7 +177,6 @@ std::pair<String, int> ShellManager::eval(
Pipe child_stdin{not input.empty()}, child_stdout, child_stderr; Pipe child_stdin{not input.empty()}, child_stdout, child_stderr;
pid_t pid = spawn_shell(m_shell.c_str(), cmdline, shell_context.params, kak_env, pid_t pid = spawn_shell(m_shell.c_str(), cmdline, shell_context.params, kak_env,
[&child_stdin, &child_stdout, &child_stderr] { [&child_stdin, &child_stdout, &child_stderr] {
set_signal_handler(SIGPIPE, SIG_DFL);
auto move = [](int oldfd, int newfd) auto move = [](int oldfd, int newfd)
{ {
if (oldfd == newfd) if (oldfd == newfd)