diff options
Diffstat (limited to 'Lib/_pyrepl/pager.py')
| -rw-r--r-- | Lib/_pyrepl/pager.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/_pyrepl/pager.py b/Lib/_pyrepl/pager.py index 1c8c1bb..1ac733e 100644 --- a/Lib/_pyrepl/pager.py +++ b/Lib/_pyrepl/pager.py @@ -76,10 +76,14 @@ def tty_pager(text: str, title: str = '') -> None: fd = sys.stdin.fileno() old = termios.tcgetattr(fd) tty.setcbreak(fd) - getchar = lambda: sys.stdin.read(1) has_tty = True + + def getchar() -> str: + return sys.stdin.read(1) + except (ImportError, AttributeError, io.UnsupportedOperation): - getchar = lambda: sys.stdin.readline()[:-1][:1] + def getchar() -> str: + return sys.stdin.readline()[:-1][:1] try: try: |
