Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Message-Id: <5.1.0.14.1.20041230013803.009fcec0@mailexpress.ica.net> X-Sender: asun AT sayeh DOT ca@mailexpress.ica.net (Unverified) Date: Thu, 30 Dec 2004 01:57:25 -0500 To: Cygwin List <cygwin AT cygwin DOT com> From: Andy Sun <asun AT sayeh DOT ca> 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: <6.2.0.14.0.20041209234542.047b2c08@pop.prospeed.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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Hi Larry, 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. 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. 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. Andy At 23:46 12/09/04 -0500, you wrote: >At 11:22 PM 12/9/2004, you wrote: > >I guess I should have been more specific with my original posting... > > > >I was running pro_batch in command-line mode (pro_batch -text ...) and not > >interactive mode, i.e. not using the GUI at all. I thought it was > implied since > >I was talking about running a shell script and a batch file. The shell > script > >actually constructs the command-line and input file automatically and then > >kicks off the DOS batch file. The script is supposed to monitor to contents > >of the file pro_batch.log.1 afterwards but it started to parse the file > contents > >even before the DOS batch file is completed. If I forced a long wait by > adding > >a "sleep 300" after the DOS batch file command, parsing was done properly. > >However, I cannot set a fix wait time as it depends on the complexity of the > >Pro/E assembly. > > > >You are correct in that the pro_batch interactive mode does work. > > >Well, I guess I need a simple example then. So far, everything I've >tried works fine. > > > >-- >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/