Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
I/O to shell function in zsh coproc
- X-seq: zsh-users 15771
- From: Rory Mulvaney <rory1@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: I/O to shell function in zsh coproc
- Date: Sat, 5 Feb 2011 11:22:40 -0600 (CST)
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
I think this is a bug in zsh (4.3.10), I can't figure out what is wrong:
function wcFunc() {
wc
}
# coproc wc : works with plain wc
coproc wcFunc
wcf=$!
# copy the write and read fd's for the coproc
exec 5>&p 6<&p
# start another null coproc to get a new target for the p fd
coproc exit
echo hi there >&5
# close the fd, so hopefully the coproc would exit, but it doesn't
exec 5>&-
# sleep $LONGTIME
# kill $wcf
var=$( cat <&6 )
echo $var
As noted, it works when I use plain wc, rather than wcFunc. Of course,
it's a lot more useful if it would work with shell functions. It also
works if you kill the coproc, but in the general case you'd need to first
wait for the estimated time it takes for the coproc to complete, and you
might not be at all sure how long it will take.
Thanks and regards,
Rory
Messages sorted by:
Reverse Date,
Date,
Thread,
Author