1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2026-01-08 10:21:12 +01:00

19105: Set shout to stderr if interative with no tty

This commit is contained in:
Peter Stephenson 2003-09-22 13:46:03 +00:00
parent f27036858a
commit 58bad19411
3 changed files with 24 additions and 5 deletions

View file

@ -1,5 +1,9 @@
2003-09-22 Peter Stephenson <pws@csr.com>
* 19105: Src/init.c, Src/jobs.c: Set shout to stderr if we
are interactive but have no terminal. Prevents crash in
history and potentially elsewhere.
* 19112: Completion/Unix/Command/_perforce: several improvements
and bug fixes.

View file

@ -379,7 +379,13 @@ init_io(void)
#endif
if (shout) {
fclose(shout);
/*
* Check if shout was set to stderr, if so don't close it.
* We do this if we are interactive but don't have a
* terminal.
*/
if (shout != stderr)
fclose(shout);
shout = 0;
}
if (SHTTY != -1) {
@ -448,9 +454,9 @@ init_io(void)
/* We will only use zle if shell is interactive, *
* SHTTY != -1, and shout != 0 */
if (interact && SHTTY != -1) {
if (interact) {
init_shout();
if(!shout)
if(!SHTTY || !shout)
opts[USEZLE] = 0;
} else
opts[USEZLE] = 0;
@ -475,6 +481,14 @@ mod_export void
init_shout(void)
{
static char shoutbuf[BUFSIZ];
if (SHTTY == -1)
{
/* Since we're interative, it's nice to have somewhere to write. */
shout = stderr;
return;
}
#if defined(JOB_CONTROL) && defined(TIOCSETD) && defined(NTTYDISC)
int ldisc = NTTYDISC;

View file

@ -322,8 +322,9 @@ update_job(Job jn)
}
}
if (shout && !ttyfrozen && !jn->stty_in_env && !zleactive &&
job == thisjob && !somestopped && !(jn->stat & STAT_NOSTTY))
if (shout && shout != stderr && !ttyfrozen && !jn->stty_in_env &&
!zleactive && job == thisjob && !somestopped &&
!(jn->stat & STAT_NOSTTY))
gettyinfo(&shttyinfo);
if (isset(MONITOR)) {