diff -r b0b4c4d365b1 Lib/pydoc.py --- a/Lib/pydoc.py Fri Mar 27 15:42:37 2015 +0100 +++ b/Lib/pydoc.py Fri Mar 27 15:07:53 2015 -0400 @@ -1450,11 +1450,16 @@ import subprocess proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE) try: - with proc: - with io.TextIOWrapper(proc.stdin, errors='backslashreplace') as pipe: - pipe.write(text) + with io.TextIOWrapper(proc.stdin, errors='backslashreplace') as pipe: + pipe.write(text) except OSError: pass # Ignore broken pipes caused by quitting the pager program. + while True: + try: + proc.wait() + break + except KeyboardInterrupt: + print('KeyboardInterrupt') def tempfilepager(text, cmd): """Page through text by invoking a program on a temporary file."""