diff options
author | R David Murray <rdmurray@bitdance.com> | 2015-03-30 14:15:22 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2015-03-30 14:15:22 (GMT) |
commit | c156e51668f23ce2da783abcc19b3fa19fe8f90d (patch) | |
tree | 82f04a1190c536ab3ca75e4989affaaeeb23151e /Lib/pydoc.py | |
parent | 93692bba3e00dc35b70af9f9185a9299d16e2f22 (diff) | |
parent | e7f5e147cdc32e7660586ce29ca97ccfe14c97f5 (diff) | |
download | cpython-c156e51668f23ce2da783abcc19b3fa19fe8f90d.zip cpython-c156e51668f23ce2da783abcc19b3fa19fe8f90d.tar.gz cpython-c156e51668f23ce2da783abcc19b3fa19fe8f90d.tar.bz2 |
Merge: #23792: also catch interrupt around pipe.write.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 7a625e1..9f3401f 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1451,7 +1451,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: |