Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Using zle outside zsh
- X-seq: zsh-users 7917
- From: DervishD <disposable1@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Using zle outside zsh
- Date: Tue, 24 Aug 2004 11:39:21 +0200
- In-reply-to: <Pine.LNX.4.61.0408231436340.3917@xxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: Pleyades
- References: <20040823155951.GA24279@DervishD> <Pine.LNX.4.61.0408231018430.5997@xxxxxxxxxxxxxxxxxx> <20040823194613.GA25072@DervishD> <Pine.LNX.4.61.0408231436340.3917@xxxxxxxxxxxxxxxxxx>
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:
#!/bin/zsh
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
do
[[ "$line" == "quit" ]] && break
zpty -w ftp "$line"
#This blocks forever.
zpty -r ftp response '(|*\n)ftp> '
print -nr $response
done
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