From: Brendan Cully Date: Thu, 16 Aug 2007 16:32:33 +0000 (-0700) Subject: Check for lost tty if getch returns error (closes #1220) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d0fa2582fc9012c5edd6f4156fa76e76a01d33c;p=neomutt Check for lost tty if getch returns error (closes #1220) Great thanks to Vincent Lefevre for tracking this one down. --- diff --git a/curs_lib.c b/curs_lib.c index e9dbaa8b3..c80045637 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -99,8 +99,16 @@ event_t mutt_getch (void) mutt_query_exit (); if(ch == ERR) + { + /* either timeout or the terminal has been lost */ + if (!isatty (0)) + { + endwin (); + exit (1); + } return err; - + } + if ((ch & 0x80) && option (OPTMETAKEY)) { /* send ALT-x as ESC-x */