1
0
mirror of https://github.com/mnaberez/py65.git synced 2025-03-13 00:29:40 +00:00

Revert "Ignore termios error in getch_noblock(). Fixes #46"

This reverts commit 7ed4d95885f91b70c5814ec308d5d2eb78d13f23.
This commit is contained in:
Mike Naberezny 2018-10-12 10:30:29 -07:00
parent 2df8152d27
commit cd673d50d1
2 changed files with 2 additions and 10 deletions

View File

@ -5,10 +5,6 @@
Py65 now requires Python 3.4 or later. On Python 2, Py65 now requires
Python 2.7.
- Added a workaround to ignore an error ``Error: <class 'termios.error'>,
(25, 'Inappropriate ioctl for device')`` that may occur on some systems
when reading character input. Based on a patch by Marko Lauke.
1.1.0 (2018-07-01)
------------------

View File

@ -49,14 +49,9 @@ else:
character. If no character is available, an empty string is returned.
"""
char = ''
fd = stdin.fileno()
try:
oldterm = termios.tcgetattr(fd)
except termios.error: # https://github.com/mnaberez/py65/issues/46
return char
oldterm = termios.tcgetattr(fd)
newattr = oldterm[:]
newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECHO
termios.tcsetattr(fd, termios.TCSANOW, newattr)
@ -65,6 +60,7 @@ else:
fcntl.fcntl(fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)
try:
char = ''
r, w, e = select.select([fd], [], [], 0.1)
if r:
char = stdin.read(1)