mirror of https://github.com/python/cpython
gh-112800: Ignore PermissionError on SubprocessTransport.close() in asyncio (#112803)
In case the spawned process is setuid, we may not be able to send signals to it, in which case our .kill() call will raise PermissionError. Ignore that in order to avoid .close() raising an exception. Hopefully the process will exit as a result of receiving EOF on its stdin.
This commit is contained in:
parent
ca71987f4e
commit
0187a7e4ec
|
@ -115,7 +115,8 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
|
|||
|
||||
try:
|
||||
self._proc.kill()
|
||||
except ProcessLookupError:
|
||||
except (ProcessLookupError, PermissionError):
|
||||
# the process may have already exited or may be running setuid
|
||||
pass
|
||||
|
||||
# Don't clear the _proc reference yet: _post_init() may still run
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Fix :mod:`asyncio` ``SubprocessTransport.close()`` not to throw
|
||||
``PermissionError`` when used with setuid executables.
|
Loading…
Reference in New Issue