From b2b81414cc6f4c2c4b5539a680c074c8c4592af7 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 12 May 2016 21:43:48 +0300 Subject: Fix issues with SIGPIPE. --- builtin.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'builtin.c') diff --git a/builtin.c b/builtin.c index d7101c26..fb67af4c 100644 --- a/builtin.c +++ b/builtin.c @@ -2092,6 +2092,10 @@ do_system(int nargs) cmd[tmp->stlen] = '\0'; os_restore_mode(fileno(stdin)); +#ifdef SIGPIPE + signal(SIGPIPE, SIG_DFL); +#endif + status = system(cmd); /* * 3/2016. What to do with ret? It's never simple. @@ -2123,8 +2127,12 @@ do_system(int nargs) } else ret = 0; /* shouldn't get here */ } + if ((BINMODE & BINMODE_INPUT) != 0) os_setbinmode(fileno(stdin), O_BINARY); +#ifdef SIGPIPE + signal(SIGPIPE, SIG_IGN); +#endif cmd[tmp->stlen] = save; } -- cgit v1.2.3