mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Merge: #23792: also catch interrupt around pipe.write.
This commit is contained in:
commit
c156e51668
1 changed files with 6 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue