MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / pipepager

Function pipepager

tools/python-3.11.9-amd64/Lib/pydoc.py:1681–1703  ·  view source on GitHub ↗

Page through text by feeding it to another program.

(text, cmd)

Source from the content-addressed store, hash-verified

1679 return re.sub('.\b', '', text)
1680
1681def pipepager(text, cmd):
1682 """Page through text by feeding it to another program."""
1683 import subprocess
1684 proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
1685 errors='backslashreplace')
1686 try:
1687 with proc.stdin as pipe:
1688 try:
1689 pipe.write(text)
1690 except KeyboardInterrupt:
1691 # We've hereby abandoned whatever text hasn't been written,
1692 # but the pager is still in control of the terminal.
1693 pass
1694 except OSError:
1695 pass # Ignore broken pipes caused by quitting the pager program.
1696 while True:
1697 try:
1698 proc.wait()
1699 break
1700 except KeyboardInterrupt:
1701 # Ignore ctl-c like the pager itself does. Otherwise the pager is
1702 # left running and the terminal is in raw mode and unusable.
1703 pass
1704
1705def tempfilepager(text, cmd):
1706 """Page through text by invoking a program on a temporary file."""

Callers 1

getpagerFunction · 0.85

Calls 2

waitMethod · 0.95
writeMethod · 0.45

Tested by

no test coverage detected