zTrix/zio

read_until in tty mode

cbmixx opened this issue · 1 comments

from zio import *
io = zio(['ssh', 'nobody@127.0.0.1'], stdin=TTY_RAW, stdout=TTY_RAW, timeout=5)
io.read_until('assword')
io.interact()

expected behavior: go through interact
what happened: timeout when read_until

As commented in test/userpass.py Password prompt, as well as input echo, is put back by stdin, not stdout or stderr.

If you use https://github.com/pexpect/pexpect you will see that you can expect "password", but the problem is that you can also expect what you write, which is not designed behavior of zio, zio tries to use a io model that people write things and get response by the remote, no need to bother about things like pty handling, raw mode, cooked mode switching, socket recv buffer. But the reality is, if someone does not understand those internals, he/she will always encounter issues like this one.

So sad.

Any suggested solution for this issue?