cpython: 7a5f30babc72 (original) (raw)
Mercurial > cpython
changeset 95298:7a5f30babc72 3.4
#23792: also catch interrupt around pipe.write. The previous patch only dealt with KeyboardInterrupt when all of the data had been consumed by the pager. This deals with the interrupt when some data is still pending. [#23792]
R David Murray rdmurray@bitdance.com | |
---|---|
date | Mon, 30 Mar 2015 10:14:47 -0400 |
parents | 9d3013a383eb |
children | 536c4f4acae1 28b778b0a132 |
files | Lib/pydoc.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-)[+] [-] Lib/pydoc.py 7 |
line wrap: on
line diff
--- 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)[](#l1.7)
try:[](#l1.8)
pipe.write(text)[](#l1.9)
except KeyboardInterrupt:[](#l1.10)
# We've hereby abandoned whatever text hasn't been written,[](#l1.11)
# but the pager is still in control of the terminal.[](#l1.12)
except OSError: pass # Ignore broken pipes caused by quitting the pager program. while True:pass[](#l1.13)