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

Re: Using zle outside zsh



On Mon, 23 Aug 2004, DervishD wrote:

>     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:

     If a PATTERN is given as well, output is read until the whole
     string read matches the PATTERN, even in the non-blocking case.

Note "the whole string".  This is why nslookup always has a "*" as the
first thing in the pattern when it calls "zpty -r".  So ...

  zpty -r telnet response $'(|*\n)telnet>'

... is probably more along the lines of what you want.

>     But the worst problem is in the inner loop. I want zpty to read
> all that 'telnet' spits until it finds 'telnet>', but blocks forever.

Same problem, I think.



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