diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2003-09-22 13:46:03 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2003-09-22 13:46:03 +0000 |
commit | 58bad19411cce9ee0a0edf3ef93acb475b7e7a79 (patch) | |
tree | 94efc673f6464fb2105017ff9d9d993517c9c8da /Src/init.c | |
parent | f27036858ae1b2e61b40d0467ba88566dc8863f6 (diff) | |
download | zsh-58bad19411cce9ee0a0edf3ef93acb475b7e7a79.tar.gz zsh-58bad19411cce9ee0a0edf3ef93acb475b7e7a79.tar.xz zsh-58bad19411cce9ee0a0edf3ef93acb475b7e7a79.zip |
19105: Set shout to stderr if interative with no tty
Diffstat (limited to 'Src/init.c')
-rw-r--r-- | Src/init.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Src/init.c b/Src/init.c index 5c395afe2..51cbe0d3a 100644 --- a/Src/init.c +++ b/Src/init.c @@ -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; |