1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-06-09 10:29:35 +00:00

Add try block around stdin.read for cygwin

This commit is contained in:
Sam Colwell 2019-01-12 14:48:45 -05:00
parent d38831db1f
commit c2a64546cb

View File

@ -60,7 +60,6 @@ else:
except:
# Quietly ignore termios errors, such as stdin not being
# a tty.
print("DEBUG: Exception getting termios settings")
pass
def noncanonical_mode(stdin):
@ -115,9 +114,15 @@ else:
noncanonical_mode(stdin)
# If we didn't get a character, ask again.
while char == '':
char = stdin.read(1)
# stdin has already been set up with a 0.1s delay, so we
# don't need an additional delay here.
try:
char = stdin.read(1)
# stdin has already been set up with a 0.1s delay, so we
# don't need an additional delay here.
except KeyboardInterrupt:
# Pass along a CTRL-C interrupt.
raise
except:
pass
return char
def getch_noblock(stdin):
@ -128,7 +133,13 @@ else:
# Using non-blocking read
noncanonical_mode(stdin)
char = stdin.read(1)
try:
char = stdin.read(1)
except KeyboardInterrupt:
# Pass along a CTRL-C interrupt.
raise
except:
pass
if char == "\n":
char = "\r"