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.
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
--- /dev/null
+Fix :mod:`asyncio` ``SubprocessTransport.close()`` not to throw
+``PermissionError`` when used with setuid executables.