Refactoring sigchld ref. #156 (#159)

This commit is contained in:
Stein Gunnar Bakkeby 2024-11-25 20:48:52 +01:00 committed by GitHub
parent c4c5113fbd
commit 4dec55eead
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 49 deletions

View file

@ -1,5 +1,3 @@
int extpipeactive = 0;
void
#if EXTERNALPIPEIN_PATCH
extpipe(const Arg *arg, int in)
@ -64,7 +62,6 @@ externalpipe(const Arg *arg)
close(to[1]);
/* restore */
signal(SIGPIPE, oldsigpipe);
extpipeactive = 1;
}
#if EXTERNALPIPEIN_PATCH

View file

@ -40,7 +40,5 @@ newterm(const Arg* a)
default:
exit(0);
}
default:
wait(NULL);
}
}

View file

@ -1,15 +1,18 @@
#include <sys/wait.h>
void
plumb(char *sel) {
plumb(char *sel)
{
if (sel == NULL)
return;
char cwd[PATH_MAX];
pid_t child;
if (subprocwd(cwd) != 0)
return;
switch(child = fork()) {
switch (child = fork()) {
case -1:
return;
case 0:
@ -18,7 +21,5 @@ plumb(char *sel) {
if (execvp(plumb_cmd, (char *const []){plumb_cmd, sel, 0}) == -1)
exit(1);
exit(0);
default:
waitpid(child, NULL, 0);
}
}
}