From cb01b5ee44a59f555619700f351be047e2de03f5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 3 Jun 2022 21:38:49 +0530 Subject: [PATCH] DRYer --- kitty/child.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kitty/child.c b/kitty/child.c index 3af3cb5b8..36f0dc978 100644 --- a/kitty/child.c +++ b/kitty/child.c @@ -101,7 +101,7 @@ spawn(PyObject *self UNUSED, PyObject *args) { sigset_t signals = {0}; struct sigaction act = {.sa_handler=SIG_DFL}; #define SA(which) { if (sigaction(which, &act, NULL) != 0) exit_on_err("sigaction() in child process failed"); } - SA(SIGINT); SA(SIGTERM); SA(SIGCHLD); + SA(SIGINT); SA(SIGTERM); SA(SIGCHLD); SA(SIGPIPE); #undef SA if (sigprocmask(SIG_SETMASK, &signals, NULL) != 0) exit_on_err("sigprocmask() in child process failed"); // Use only signal-safe functions (man 7 signal-safety) @@ -139,9 +139,6 @@ spawn(PyObject *self UNUSED, PyObject *args) { for (int c = 3; c < 201; c++) safe_close(c, __FILE__, __LINE__); environ = env; - // for some reason SIGPIPE is set to SIG_IGN, so reset it, needed by bash, - // which does not reset signal handlers on its own - signal(SIGPIPE, SIG_DFL); execvp(exe, argv); // Report the failure and exec a shell instead, so that we are not left // with a forked but not exec'ed process