delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/11/08/09:21:07

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <BAY126-W5499D9B6F4888F393CAC45CB8B0@phx.gbl>
From: =?iso-8859-1?Q?Morten_Kj=E6rulff?= <mortenkjarulff AT hotmail DOT com>
To: <cygwin AT cygwin DOT com>
Subject: Issue with bash coprocess
Date: Thu, 8 Nov 2007 15:20:46 +0100
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id lA8EKtHt012588

My previous post should have been written like this:
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 - En verden af oplevelser
http://www.windowslive.dk/?cmp=textlink

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019