mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 08:10:10 +01:00
terminal: Restore SIGPIPE signal handler to oldact (SIG_DFL)
Prior to executing a new command restore the parent process to the default SIG_DLF handler as we normally use SIG_IGN it to avoid crashing on pasted input. As we seem to be hitting a Broken Pipe message when running certain scripts, it seem we need to restore back the default handler. This is similar to what other folks have been doing in https://github.com/labwc/labwc/issues/1209. Fixes: #994 Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
parent
46f25304c1
commit
f0ee8be804
1 changed files with 7 additions and 1 deletions
|
|
@ -58,6 +58,7 @@ static char *option_term;
|
|||
static char *option_shell;
|
||||
|
||||
static struct wl_list terminal_list;
|
||||
struct sigaction oldact;
|
||||
|
||||
static struct terminal *
|
||||
terminal_create(struct display *display);
|
||||
|
|
@ -3100,6 +3101,9 @@ terminal_run(struct terminal *terminal, const char *path)
|
|||
close(pipes[0]);
|
||||
setenv("TERM", option_term, 1);
|
||||
setenv("COLORTERM", option_term, 1);
|
||||
|
||||
sigaction(SIGPIPE, &oldact, NULL);
|
||||
|
||||
if (execl(path, path, NULL)) {
|
||||
printf("exec failed: %s\n", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
@ -3177,8 +3181,10 @@ int main(int argc, char *argv[])
|
|||
* socket whose reading end has been closed */
|
||||
sigpipe.sa_handler = SIG_IGN;
|
||||
sigemptyset(&sigpipe.sa_mask);
|
||||
sigemptyset(&oldact.sa_mask);
|
||||
|
||||
sigpipe.sa_flags = 0;
|
||||
sigaction(SIGPIPE, &sigpipe, NULL);
|
||||
sigaction(SIGPIPE, &sigpipe, &oldact);
|
||||
|
||||
d = display_create(&argc, argv);
|
||||
if (d == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue