river: fix SIGPIPE handling, cleanup fork/execve

Installing an empty handler does not have the same effect as using
SIG_IGN as the failing write syscall will not return EPIPE.
This commit is contained in:
Isaac Freund
2022-08-11 12:02:30 +02:00
parent 600fd2e73c
commit 1a9cba2aa9
3 changed files with 28 additions and 18 deletions

View File

@ -40,10 +40,7 @@ pub fn spawn(
};
if (pid == 0) {
// Clean things up for the child in an intermediate fork
if (c.setsid() < 0) unreachable;
if (os.system.sigprocmask(os.SIG.SETMASK, &os.empty_sigset, null) < 0) unreachable;
util.post_fork_pre_execve();
const pid2 = os.fork() catch c._exit(1);
if (pid2 == 0) os.execveZ("/bin/sh", &child_args, std.c.environ) catch c._exit(1);