Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Using zle outside zsh

    Hi Bart :)

 * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> >     The problem here is that if the command prints its own prompt, a
> > code like this:
> [...]
> > zpty -r telnet response 'telnet>'
> > print -nr $response
> [...]
> >     doesn't work, because the prompt doesn't have a carriage return.
> That's not why it doesn't work.  Read the doc for "zpty -r" again:
> Note "the whole string".

    Yes, my fault, but that doesn't solve the problem :( With that
change the first read works but the second doesn't. I've tested with
my system's telnet and ftp. The code is now:


emulate -L zsh

zpty -b ftp ftp

# This worked as before since the line is exactly 'ftp> '.
# Same for telnet
zpty -r ftp response '(|*\n)ftp> '
# This doesn't print anything until a '\n' is printed :((
print -nr $response

while line=''; vared -e line
    [[ "$line" == "quit" ]] && break

    zpty -w ftp "$line"

    #This blocks forever.
    zpty -r ftp response '(|*\n)ftp> '
    print -nr $response

zpty -w ftp "quit"
zpty -d ftp

    If I change the pattern in the read that blocks forever for
something like '*progress', it reads until 'progress is found', no
problem! but when I extend it to read the prompt, it blocks forever.

    My other problem is still that print -n doesn't print anything
until a '\n' is output. Can I solve this using some option or should
I mess with 'stty'?

    BTW, the problem is the same using coprocesses and read -p...

    Thanks again, Bart.

    Raúl Núñez de Arenas Coronado

Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/

Messages sorted by: Reverse Date, Date, Thread, Author