r80345 - pyrepl/trunk/pyrepl/pyrepl

[email protected] Tue, 15 Feb 2011 00:16:36 +0100 (CET)
Newsgroups gmane.comp.python.pyrepl.checkins
Message-ID <[email protected]>
Author: afa
Date: Tue Feb 15 00:16:35 2011
New Revision: 80345

Modified:
   pyrepl/trunk/pyrepl/pyrepl/unix_eventqueue.py
Log:
Fix the termios module: now RPython termios
raises OSError to better convey the errno attribute.
Also fix a failure with readline when stdin is not a tty.



Modified: pyrepl/trunk/pyrepl/pyrepl/unix_eventqueue.py
==============================================================================
--- pyrepl/trunk/pyrepl/pyrepl/unix_eventqueue.py	(original)
+++ pyrepl/trunk/pyrepl/pyrepl/unix_eventqueue.py	Tue Feb 15 00:16:35 2011
@@ -25,6 +25,7 @@
 from pyrepl.console import Event
 from pyrepl import curses
 from termios import tcgetattr, VERASE
+import os
 
 _keynames = {
     "delete" : "kdch1",
@@ -52,7 +53,8 @@
             keycode = curses.tigetstr(tiname)
             if keycode:
                 our_keycodes[keycode] = unicode(key)
-        our_keycodes[tcgetattr(fd)[6][VERASE]] = u'backspace'
+        if os.isatty(fd):
+            our_keycodes[tcgetattr(fd)[6][VERASE]] = u'backspace'
         self.k = self.ck = keymap.compile_keymap(our_keycodes)
         self.events = []
         self.buf = []