Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
coproc problem when input closed but output open
- X-seq: zsh-users 15872
- From: Rory Mulvaney <rory1@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: coproc problem when input closed but output open
- Date: Tue, 15 Mar 2011 14:04:49 -0500 (CDT)
- 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
Thanks for the tip involving calling coproc exit at the begnning of a
coproc shell function, I think using coproc that way is really useful.
Now I'm having trouble with another example, where the coproc doesn't
return without killing it. Maybe the problem has something to do with the
output file descriptor of the coproc still being open. But shouldn't the
coproc finish writing its output and exit?
Thanks,
Rory M.
function wcFunc() {
coproc exit
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
# copy output of coproc to stdout
cat <&6 &
exec 6<&-
echo hi there >&5
# close the fd, so hopefully the coproc would exit, but it doesn't
exec 5>&-
Messages sorted by:
Reverse Date,
Date,
Thread,
Author