diff options
author | Allison Karlitskaya <allison.karlitskaya@redhat.com> | 2023-12-24 00:43:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-24 00:43:39 (GMT) |
commit | 0187a7e4ec9550a6e35dd06b26f22863520242ab (patch) | |
tree | 0113b3448a127d2f00b8eccf2eca27aa06e524ea /Lib/asyncio/base_subprocess.py | |
parent | ca71987f4e3be56a369a1dd57763c6077b3c4899 (diff) | |
download | cpython-0187a7e4ec9550a6e35dd06b26f22863520242ab.zip cpython-0187a7e4ec9550a6e35dd06b26f22863520242ab.tar.gz cpython-0187a7e4ec9550a6e35dd06b26f22863520242ab.tar.bz2 |
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.
Diffstat (limited to 'Lib/asyncio/base_subprocess.py')
-rw-r--r-- | Lib/asyncio/base_subprocess.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py index 4c9b0dd..6dbde2b 100644 --- a/Lib/asyncio/base_subprocess.py +++ b/Lib/asyncio/base_subprocess.py @@ -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 |