delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/06/28/09:36:31

X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: loop hanging
Date: Wed, 28 Jun 2006 14:36:18 +0100
Message-ID: <009a01c69ab7$d5dd2350$a501a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <5084194.post@talk.nabble.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On 28 June 2006 14:23, prz wrote:

> I have a small program that executes a command and parses the output
> I can see that on many executions the program hangs.
> added some debug statements and could see it is at loop iteration that we
> hang
> sample code
> #!/cygdrive/c/Cygwin/bin/bash
> db2 list db directory | {
> 	while read DBREC
> 	do
>     [[ ! -z $DEBUG  ]] && echo "p6"
>         statements....
>         [[ ! -z $DEBUG  ]] && echo "p5"
>     done
>     }
> the last output before hang is always p5
> Any idea/hint why this is occuring ?

  It must have got stuck in the read statement somehow.  Can you workaround by
separating it in two and using a temp file, i.e.

> #!/cygdrive/c/Cygwin/bin/bash
> db2 list db directory >foo.tmp
> while read DBREC <foo.tmp
> do
>     [[ ! -z $DEBUG  ]] && echo "p6"
>     statements....
>     [[ ! -z $DEBUG  ]] && echo "p5"
> done


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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