Revert "Handle SIGCHLD signals when piping"

This reverts commit 8208e75294.
This commit is contained in:
Maxime Coste 2014-12-03 13:57:04 +00:00
parent 0517a19e6d
commit 24519e645e

View File

@ -50,10 +50,6 @@ String ShellManager::pipe(StringView input,
::pipe(read_pipe); ::pipe(read_pipe);
::pipe(error_pipe); ::pipe(error_pipe);
static sig_atomic_t exited; exited = 0;
static sig_atomic_t sig_exit_status;
signal(SIGCHLD, [](int) { wait(&sig_exit_status); exited = 1; });
String output; String output;
if (pid_t pid = fork()) if (pid_t pid = fork())
{ {
@ -86,13 +82,7 @@ String ShellManager::pipe(StringView input,
if (not error.empty()) if (not error.empty())
write_debug("shell stderr: <<<\n" + error + ">>>"); write_debug("shell stderr: <<<\n" + error + ">>>");
signal(SIGCHLD, SIG_DFL);
if (not exited)
waitpid(pid, exit_status, 0); waitpid(pid, exit_status, 0);
else if (exit_status)
*exit_status = sig_exit_status;
if (exit_status) if (exit_status)
{ {
if (WIFEXITED(*exit_status)) if (WIFEXITED(*exit_status))