asyncio: BaseSubprocessTransport.close() doesn't try to kill the process if it

already finished
This commit is contained in:
Victor Stinner 2015-02-10 14:49:32 +01:00
parent 832dd5f0d6
commit 8e36812e27
2 changed files with 61 additions and 1 deletions

View file

@ -93,7 +93,12 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
continue
proto.pipe.close()
if self._proc is not None and self._returncode is None:
if (self._proc is not None
# the child process finished?
and self._returncode is None
# the child process finished but the transport was not notified yet?
and self._proc.poll() is None
):
if self._loop.get_debug():
logger.warning('Close running child process: kill %r', self)