Message336236
I think this is somewhat similar to issue14252. The problem I see is that we should either raise ProcessLookupError or ignore the error (better). This concept of suppressing errors if process is gone is currently already established in 2 places:
https://github.com/python/cpython/blob/bafa8487f77fa076de3a06755399daf81cb75598/Lib/subprocess.py#L1389
Basically what I propose is to extend the existing logic to also include ERROR_INVALID_HANDLE other than ERROR_ACCESS_DENIED. Not tested:
def terminate(self):
"""Terminates the process."""
# Don't terminate a process that we know has already died.
if self.returncode is not None:
return
try:
_winapi.TerminateProcess(self._handle, 1)
except WindowsError as err:
if err.errno in (ERROR_ACCESS_DENIED, ERROR_INVALID_HANDLE):
rc = _winapi.GetExitCodeProcess(self._handle)
if rc == _winapi.STILL_ACTIVE:
raise
self.returncode = rc
else:
raise |
|
Date |
User |
Action |
Args |
2019-02-21 16:52:48 | giampaolo.rodola | set | recipients:
+ giampaolo.rodola, vstinner |
2019-02-21 16:52:48 | giampaolo.rodola | set | messageid: <1550767968.68.0.591840501491.issue36067@roundup.psfhosted.org> |
2019-02-21 16:52:48 | giampaolo.rodola | link | issue36067 messages |
2019-02-21 16:52:48 | giampaolo.rodola | create | |
|