mirror of
https://github.com/mnaberez/py65.git
synced 2025-08-07 22:25:01 +00:00
Add try block around stdin.read for cygwin
This commit is contained in:
@@ -60,7 +60,6 @@ else:
|
|||||||
except:
|
except:
|
||||||
# Quietly ignore termios errors, such as stdin not being
|
# Quietly ignore termios errors, such as stdin not being
|
||||||
# a tty.
|
# a tty.
|
||||||
print("DEBUG: Exception getting termios settings")
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def noncanonical_mode(stdin):
|
def noncanonical_mode(stdin):
|
||||||
@@ -115,9 +114,15 @@ else:
|
|||||||
noncanonical_mode(stdin)
|
noncanonical_mode(stdin)
|
||||||
# If we didn't get a character, ask again.
|
# If we didn't get a character, ask again.
|
||||||
while char == '':
|
while char == '':
|
||||||
char = stdin.read(1)
|
try:
|
||||||
# stdin has already been set up with a 0.1s delay, so we
|
char = stdin.read(1)
|
||||||
# don't need an additional delay here.
|
# 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
|
return char
|
||||||
|
|
||||||
def getch_noblock(stdin):
|
def getch_noblock(stdin):
|
||||||
@@ -128,7 +133,13 @@ else:
|
|||||||
|
|
||||||
# Using non-blocking read
|
# Using non-blocking read
|
||||||
noncanonical_mode(stdin)
|
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":
|
if char == "\n":
|
||||||
char = "\r"
|
char = "\r"
|
||||||
|
Reference in New Issue
Block a user