in reply to system() does not wait for terminal.exe to complete executing on Windows

Please remove your <font size="10" color="blue"> tags. They are
Unnecessary
Unwanted

Then, if you can, please show us some relationship between the code you've posted and the problem you assert. Lacking a box with XP running, I'm also more than a bit confused about:

  1. What you're trying to do; what you want to accomplish?
  2. Why achieving that requires opening terminal.exe more than once?
  3. ...and, if so, why do it from a loop?
  4. and perhaps, what is "terminal.exe" that it's found in the C:/test/ directory?

Modified to use strict and warnings and to run under Linux, the script does exactly what one might expect after reading the documentation for system. Modified by substituting another (available) executable for terminal.exe the script (under w2k) also behaves as expected... and not as described.

So you might want to insert a little test right after your wait();: print "\n\t Past the wait; first execution of terminal.exe is complete\n\n"

And see what happens.

Replies are listed 'Best First'.
Re^2: system() does not wait for terminal.exe to complete executing on Windows
by spranav (Initiate) on Apr 07, 2010 at 20:05 UTC
    Thanks for your response, let me try to explain:- The terminal.exe is Terminal Emulator (like hyper term); it logs in to a hardware device over serial port and runs some command, when it is done it closes itself. Problem:- The script opens up two terminals I want it to open a terminal in first pass, wait until the terminal ends, then open the terminal again in second pass.