Check for lost tty if getch returns error (closes #1220)
authorBrendan Cully <brendan@kublai.com>
Thu, 16 Aug 2007 16:32:33 +0000 (09:32 -0700)
committerBrendan Cully <brendan@kublai.com>
Thu, 16 Aug 2007 16:32:33 +0000 (09:32 -0700)
Great thanks to Vincent Lefevre for tracking this one down.

curs_lib.c

index e9dbaa8b3a1f04c80a7bd476ed0f468fe20384d3..c800456377899fb4482b5b498803212a9fb924c9 100644 (file)
@@ -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 */