iter_read: also treat 0-byte read as disconnection

wip-fakessh-exit-status
David Wilson 7 years ago
parent d169b55d64
commit 4af920094a

@ -174,7 +174,8 @@ def iter_read(fd, deadline=None):
continue continue
s, disconnected = mitogen.core.io_op(os.read, fd, 4096) s, disconnected = mitogen.core.io_op(os.read, fd, 4096)
if disconnected: IOLOG.debug('iter_read(%r) -> %r', fd, s)
if disconnected or not s:
raise mitogen.core.StreamError( raise mitogen.core.StreamError(
'EOF on stream; last 300 bytes received: %r' % 'EOF on stream; last 300 bytes received: %r' %
(''.join(bits)[-300:],) (''.join(bits)[-300:],)

Loading…
Cancel
Save