How do I wait until a console application is idle?
Posted
by Anthony Mastrean
on Stack Overflow
See other posts from Stack Overflow
or by Anthony Mastrean
Published on 2010-04-29T19:04:54Z
Indexed on
2010/04/29
19:07 UTC
Read the original article
Hit count: 310
I have a console application that starts up, hosts a bunch of services (long-running startup), and then waits for clients to call into it. I have integration tests that start this console application and make "client" calls. How do I wait for the console application to complete its startup before making the client calls?
I want to avoid doing Thread.Sleep(int)
because that's dependent on the startup time (which may change) and I waste time if the startup is faster.
Process.WaitForInputIdle
works only on applications with a UI (and I confirmed that it does throw an exception in this case).
I'm open to awkward solutions like, have the console application write a temp file when it's ready.
© Stack Overflow or respective owner