screen_init(): Verify that STDOUT is a TTY

Before we call screen_init(), which in turn calls libite:initscr(),
which in turn does a lot of tcgetattr() and termios to STDOUT to figure
out the size, we need to check that we're not backgrounded, or don't
actually have a TTY.  Problem reported by @wkz

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-10-23 19:16:51 +02:00
1 parent 949f02eff4
commit a6290da210
1 file changed
+3
+3
View File
@@ -75,6 +75,9 @@ char *sanitize(char *arg, size_t len)
void screen_init(void)
{
if (!isatty(STDOUT_FILENO))
return
initscr(&screen_rows, &screen_cols);
}