in reply to Win32::Process handling

How does the process report the error? Does it create a file somewhere? Or does it show a dialog box? Does it write something to STDERR?

If the first, you only need a loop similar to this:

my $loopcount = 0; 1 while (! $process->Wait(1000) and ! -e $the_file and $loopcount++ < +$timeout); if ($loopcount >= $timeout) { ... fead up with waiting. } elsif (-e $the_file) { ... it errored out } else { ... it did its work }

In the second case you should try it Win32::GuiTest's FindWindowLike() sees that error message box and then the loop will be similar. Just instead of -e $the_file you'll have something like FindWindowLike(0, "^My program error", undef). Plus maybe it'll be better if you find the main program window first and then only search among its children.

In the third case you'll have to

  1. store the STDIN, STDOUT and STDERR
  2. close them and open them to something else. Most probably you will want to pipe() to STDIN and open STDOUT and STDERR to a file (keep in mind that you cannot select() on anything but socket()s under Windows, AFAIK)
  3. start the process with INHERIT_HANDLES flag
  4. restore STDIN, STDOUT and STDERR
  5. print whatever you need to the pipe() leading to the program's STDIN (and hope the pipe is big enough and/or the program is reading)
  6. loop and test the files to that the process's STDOUT and STDERR write

I can go into more detail on the 2nd and 3rd if that is what you need.

  Jenda@Krynicky.cz