I have an app that uses startAsProcess to launch an EXE. I’d like to wait for that EXE to finish doing its thing then display a log from it. The amount of time the EXE takes to finish is arbitrary. It doesn’t look like there’s anything that would give me a process handle when I launch the EXE, and nothing that would be able to tell me when it’s finished. I don’t see any InterprocessConnection stuff that would help, either.
I might be able to use File::getLastModificationTime on one of the two files the EXE creates, as long as the files are only written when the process exits (not sure), but I was hoping there was a more normal way to see when the process ended.
Alternatively you could use _spawnl(…) to start the process instead of ShellExecute which is a real high level function that does not return a process handle.
For docs on the C-Runtime lib function _spawnl(…) see http://msdn.microsoft.com/en-us/library/wweek9sc(VS.80).aspx
while I don’t know the method off the top of my head, you should be able to retrieve the handle of a running process, and with the handle use something like WaitForSingleObject to block until the process exits.