1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-22 12:31:26 +01:00

33268: interactive shells treat SIGPIPE like SIGHUP if and only if SHTTY is disconnected

This commit is contained in:
Barton E. Schaefer 2014-09-29 08:59:31 -07:00
parent 7cabee52d8
commit 60e31a45b0
4 changed files with 21 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2014-09-28 Barton E. Schaefer <schaefer@zsh.org>
* 33268: Src/exec.c, Src/init.c, Src/signals.c: interactive shells
treat SIGPIPE like SIGHUP if and only if SHTTY is disconnected
2014-09-27 Barton E. Schaefer <schaefer@zsh.org>
* 33256: Src/prompt.c: fix prompttrunc() counting of %{ %} spans

View file

@ -1005,6 +1005,8 @@ entersubsh(int flags)
signal_default(SIGTERM);
if (!(sigtrapped[SIGINT] & ZSIG_IGNORED))
signal_default(SIGINT);
if (!(sigtrapped[SIGPIPE]))
signal_default(SIGPIPE);
}
if (!(sigtrapped[SIGQUIT] & ZSIG_IGNORED))
signal_default(SIGQUIT);

View file

@ -1134,6 +1134,7 @@ init_signals(void)
winch_block(); /* See utils.c:preprompt() */
#endif
if (interact) {
install_handler(SIGPIPE);
install_handler(SIGALRM);
signal_ignore(SIGTERM);
}

View file

@ -594,6 +594,17 @@ zhandler(int sig)
wait_for_processes();
break;
case SIGPIPE:
if (!handletrap(SIGPIPE)) {
if (!interact)
_exit(SIGPIPE);
else if (!isatty(SHTTY)) {
stopmsg = 1;
zexit(SIGPIPE, 1);
}
}
break;
case SIGHUP:
if (!handletrap(SIGHUP)) {
stopmsg = 1;
@ -897,6 +908,8 @@ removetrap(int sig)
noholdintr();
} else if (sig == SIGHUP)
install_handler(sig);
else if (sig == SIGPIPE && interact && !forklevel)
install_handler(sig);
else if (sig && sig <= SIGCOUNT &&
#ifdef SIGWINCH
sig != SIGWINCH &&