You've modified input
:
input.append(conn)
(and then called conn.recv
to get some data, which will block until there is some data or EOF, but presumably there was some and you got it).
Having done that, on the next trip through the loop, it's likely that there is receive data, or EOF, ready for input on conn
. I assume you immediately call child.expect
(because s == conn
and hence s != server
). I'd bet that at this point, conn
is at EOF, so that returns immediately, having done nothing. conn
is still open, and still in input
, so every time you call select
it returns right away telling you that you can read another EOF from conn
.