From a8af5939e7d9dd4b8fafbb26bd9ad8faa0909084 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Fri, 21 Feb 2025 14:50:41 +0200 Subject: [PATCH] terminal: Restore SIGPIPE to default Prior to executing a new command make SIGPIPE to the default action as we normally disable to avoid. Otherwise we seem to be hitting a Broken Pipe message when running certain scripts. 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 --- clients/terminal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clients/terminal.c b/clients/terminal.c index 871391acf5..855318c118 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -3091,6 +3091,7 @@ terminal_run(struct terminal *terminal, const char *path) pid = forkpty(&master, NULL, NULL, NULL); if (pid == 0) { int ret; + struct sigaction sigpipe; close(pipes[1]); do { @@ -3100,6 +3101,10 @@ terminal_run(struct terminal *terminal, const char *path) close(pipes[0]); setenv("TERM", option_term, 1); setenv("COLORTERM", option_term, 1); + + sigpipe.sa_handler = SIG_DFL; + sigaction(SIGPIPE, &sigpipe, NULL); + if (execl(path, path, NULL)) { printf("exec failed: %s\n", strerror(errno)); exit(EXIT_FAILURE); -- GitLab