First of all: I know this is rather old but there still is not an accepted answer, so perhaps my approach will help someone else. :)
What I did to solve this is:
process.Start();
while (true)
{
try
{
var time = process.StartTime;
break;
}
catch (Exception) {}
}
The association var time = process.StartTime
will throw an exception as long as process did not start. So once it passes, it is safe to assume process is running and to work with it further. I am using this to wait for java process to start up, since it takes some time. This way it should be independent on what machine the application is running rather than using Thread.Sleep()
.
I understand this is not very clean solution, but the only one that should be performance independent I could think of.