From 6d0fa2582fc9012c5edd6f4156fa76e76a01d33c Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Thu, 16 Aug 2007 09:32:33 -0700 Subject: [PATCH] Check for lost tty if getch returns error (closes #1220) Great thanks to Vincent Lefevre for tracking this one down. --- curs_lib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 */ -- 2.50.1