Issue with bash coprocess
Morten Kjærulff
mortenkjarulff@hotmail.com
Thu Nov 8 14:20:00 GMT 2007
Hi,
I am trying to make a coprocess in bash, I found an example here:
http://doc.mdcc.cx/cgi-bin/dwww?type=file&location=/usr/share/doc/bash-doc/examples/functions/coproc.bash
When I tried that example, it sometimes hung, so to debug it (and to understand it) I made my own version. This also hangs sometimes.
I found that it is this "exec" command that hangs:
( "$@" $fifo.o ; rm -f $fifo.i $fifo.o ) &
exec 3>$fifo.i 4$fifo.o ; rm -f $fifo.i $fifo.o ) &
sleep 5
exec 3>$fifo.i 4$fifo.i 4$fifo.o ; rm -f $fifo.i $fifo.o ) &
it does not hang, but the background subshell never ends.
To me, it seems to be a timing issue, as it (seems to) work if I put in the "sleep" command.
I have attached my script. It should give this output:
$ ./mycoproc.bash
coprocess_test_1_server: start
coprocess_test_1_client: init rc: 0
coprocess_test_1_client: put rc: 0
coprocess_test_1_client: get rc: 0
coprocess_test_1_client: REPLY: 1 + 1 = 2
coprocess_test_1_server: end
coprocess_test_1_client: term rc: 0
$
Is there an issue with my script? bash? cygwin? or me?
Cheers,
Morten
_________________________________________________________________
Windows Live Search - En søgning er nok
http://www.windowslive.dk/?cmp=LiveSearch_textlink&p=LiveSearch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mycoproc.bash
Type: application/octet-stream
Size: 1808 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20071108/26d2143c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 24220 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20071108/26d2143c/attachment-0001.obj>
-------------- next part --------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list