Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Reply-To: Cygwin List Message-Id: <6.2.0.14.0.20041230204150.04dc1670@pop.prospeed.net> Date: Thu, 30 Dec 2004 20:52:58 -0500 To: Andy Sun , Cygwin List From: Larry Hall Subject: Re: running a DOS batch file from a shell script - script doesn't wait for batch file to complete before continuing In-Reply-To: <5.1.0.14.1.20041230013803.009fcec0@mailexpress.ica.net> References: <5 DOT 1 DOT 0 DOT 14 DOT 1 DOT 20041209225754 DOT 00a09270 AT mailexpress DOT ica DOT net> <5 DOT 1 DOT 0 DOT 14 DOT 1 DOT 20041209215508 DOT 009f61b0 AT mailexpress DOT ica DOT net> <5 DOT 1 DOT 0 DOT 14 DOT 1 DOT 20041209215508 DOT 009f61b0 AT mailexpress DOT ica DOT net> <5 DOT 1 DOT 0 DOT 14 DOT 1 DOT 20041209225754 DOT 00a09270 AT mailexpress DOT ica DOT net> <5 DOT 1 DOT 0 DOT 14 DOT 1 DOT 20041230013803 DOT 009fcec0 AT mailexpress DOT ica DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" At 01:57 AM 12/30/2004, you wrote: >Hi Larry, Hi Andy, >Since you were the only person who was kind enough to take the time to respond >to my initial question, I owe it to you to provide a followup on this subject. Thanks. I appreciate that. Though it's probably fair to say that I was the only other person reading your message that even knew what Pro/E was. ;-) During my years in this forum, I think it's only popped up once before. As a result, it's not too surprising that you weren't overwhelmed by replies. ;-) >I wrote a few DOS batch files as well as shell scripts to try and troubleshoot the >problem. I managed to track down the problem to the Pro/E executable pro_batch_t.exe. >Depending on whether the "-text" option is provided to pro_batch.bat, it will either >run the UI executable or the command-line executable pro_batch_t.exe. > >The problem seems to come from pro_batch_t.exe. This program apparently >wants to run in the background and therefore it doesn't matter whether you >invoke it from a DOS batch file or a Cygwin shell script, the batch file/script will >continue to run before pro_batch_t.exe terminates. The version of Pro/E in >question is Release 20. Ah, even older than the version I was working with. In software terms, you live firmly in the ancient past. ;-) And I'm only in the distant past. The fact that pro_batch_t.exe creates a background process when run without the GUI is exactly the reason for the behavior you saw, as you found. I probably wouldn't have noticed this problem myself even if I could have run it exactly as you did because my license has expired. :-( >To solve my problem, I added two loops to my scripts, one to check for the >presence of the log file pro_batch.log.1 every 5 seconds and upon detecting >it checks every 5 seconds for the keyword "Result" which is the last line of >pro_batch.log.1 when pro_batch_t.exe is completed. It seems to do the job. Sure. That'll work. One could get fancier but there's no need to mess around with something that works and satisfies a need. Good work and thanks for the follow-up! -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 838 Washington Street (508) 893-9889 - FAX Holliston, MA 01746 -- 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/