mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
asyncio: Minimal pty support in UNIX read pipe, by Jonathan Slenders.
This commit is contained in:
parent
4835f17c24
commit
02757ea7e9
2 changed files with 47 additions and 2 deletions
|
|
@ -190,7 +190,9 @@ class _UnixReadPipeTransport(transports.ReadTransport):
|
|||
self._pipe = pipe
|
||||
self._fileno = pipe.fileno()
|
||||
mode = os.fstat(self._fileno).st_mode
|
||||
if not (stat.S_ISFIFO(mode) or stat.S_ISSOCK(mode)):
|
||||
if not (stat.S_ISFIFO(mode) or
|
||||
stat.S_ISSOCK(mode) or
|
||||
stat.S_ISCHR(mode)):
|
||||
raise ValueError("Pipe transport is for pipes/sockets only.")
|
||||
_set_nonblocking(self._fileno)
|
||||
self._protocol = protocol
|
||||
|
|
@ -228,7 +230,8 @@ class _UnixReadPipeTransport(transports.ReadTransport):
|
|||
|
||||
def _fatal_error(self, exc):
|
||||
# should be called by exception handler only
|
||||
logger.exception('Fatal error for %s', self)
|
||||
if not (isinstance(exc, OSError) and exc.errno == errno.EIO):
|
||||
logger.exception('Fatal error for %s', self)
|
||||
self._close(exc)
|
||||
|
||||
def _close(self, exc):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue