Commit c156e516 authored by R David Murray's avatar R David Murray

Merge: #23792: also catch interrupt around pipe.write.

parents 93692bba e7f5e147
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment