zsh-users
 help / color / mirror / code / Atom feed
* coproc problem when input closed but output open
@ 2011-03-15 19:04 Rory Mulvaney
  2011-03-16 14:57 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Rory Mulvaney @ 2011-03-15 19:04 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-17 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-15 19:04 coproc problem when input closed but output open Rory Mulvaney
2011-03-16 14:57 ` Bart Schaefer
2011-03-17 21:17   ` Rory Mulvaney

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).