Path: blob/main/python/cpython/src/patches/02-pydoc.patch
1067 views
--- native/Lib/pydoc.py 2022-10-24 10:35:39.000000000 -07001+++ wasm/Lib/pydoc.py 2022-11-07 07:18:02.261615004 -08002@@ -1565,6 +1565,8 @@3return plainpager4if sys.platform == "emscripten":5return plainpager6+ if sys.platform == "wasi":7+ return ttypager8use_pager = os.environ.get('MANPAGER') or os.environ.get('PAGER')9if use_pager:10if sys.platform == 'win32': # pipes completely broken in Windows11@@ -1639,13 +1641,15 @@12def ttypager(text):13"""Page through text on a text terminal."""14lines = plain(_escape_stdout(text)).split('\n')15+ import termios16try:17import tty18fd = sys.stdin.fileno()19old = tty.tcgetattr(fd)20tty.setcbreak(fd)21getchar = lambda: sys.stdin.read(1)22- except (ImportError, AttributeError, io.UnsupportedOperation):23+ # In some cases we get a "termios.error: not a tty" error in CoWasm, e.g,. when running pydoc test suite.24+ except (termios.error, ImportError, AttributeError, io.UnsupportedOperation):25tty = None26getchar = lambda: sys.stdin.readline()[:-1][:1]27282930