summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index cf9e0f0..faaa859 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1453,7 +1453,12 @@ def pipepager(text, cmd):
proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE)
try:
with io.TextIOWrapper(proc.stdin, errors='backslashreplace') as pipe:
- pipe.write(text)
+ try:
+ pipe.write(text)
+ except KeyboardInterrupt:
+ # We've hereby abandoned whatever text hasn't been written,
+ # but the pager is still in control of the terminal.
+ pass
except OSError:
pass # Ignore broken pipes caused by quitting the pager program.
while True: