WaitForExit( 1 ) never returns

  • Thread starter Thread starter Ebbe Kristensen
  • Start date Start date
E

Ebbe Kristensen

Hi All

I am writing a C# program that starts another program. Since this is
destined to run on an un-attended PC, I want to be certain that my program
can regain control. To this end, I use the WaitForExit methos with a
timeout.

So in order to test this, I added an endless loop to the other program such
that it never returns. My problem is that neither does WaitForExit. Even
WaitForExit( 1 ) never returns when the other program hangs.

Why? And what should I do to make it work?

Ebbe
 
Ebbe said:
Why? And what should I do to make it work?

Never mind - it turned out that using MyProccess.StandardError.ReadToEnd()
was the culprit. Changing that to asynchroneous collection solved the
problem.

Ebbe
 
Back
Top