• Gregory P. Smith's avatar
    bpo-25942: make subprocess more graceful on ^C (GH-5026) · f4d644f3
    Gregory P. Smith yazdı
    Do not allow receiving a SIGINT to cause the subprocess module to trigger an
    immediate SIGKILL of the child process.  SIGINT is normally sent to all child
    processes by the OS at the same time already as was the established normal
    behavior in 2.7 and 3.2.  This behavior change was introduced during the fix to https://bugs.python.org/issue12494 and is generally surprising to command line
    tool users who expect other tools launched in child processes to get their own
    SIGINT and do their own cleanup.
    
    In Python 3.3-3.6 subprocess.call and subprocess.run would immediately
    SIGKILL the child process upon receiving a SIGINT (which raises a
    KeyboardInterrupt).  We now give the child a small amount of time to
    exit gracefully before resorting to a SIGKILL.
    
    This is also the case for subprocess.Popen.__exit__ which would
    previously block indefinitely waiting for the child to die.  This was
    hidden from many users by virtue of subprocess.call and subprocess.run
    sending the signal immediately.
    
    Behavior change: subprocess.Popen.__exit__ will not block indefinitely
    when the exiting exception is a KeyboardInterrupt.  This is done for
    user friendliness as people expect their ^C to actually happen.  This
    could cause occasional orphaned Popen objects when not using `call` or
    `run` with a child process that hasn't exited.
    
    Refactoring involved: The Popen.wait method deals with the
    KeyboardInterrupt second chance, existing platform specific internals
    have been renamed to _wait().
    Also fixes comment typos.
    f4d644f3
Adı
Son kayıt (commit)
Son güncelleme
.github Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Programs Loading commit data...
Python Loading commit data...
Tools Loading commit data...
m4 Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.hgeol Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
.travis.yml Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README.rst Loading commit data...
aclocal.m4 Loading commit data...
config.guess Loading commit data...
config.sub Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...