views:

947

answers:

3

I want to wait for a process to finish, but process.WaitForExit() hangs my GUI. Is there an event-based way, or do I need to spawn a thread to block until exit, then delegate the event myself?

+1  A: 
   System.Diagnostics.Process.Exited
Matt Brunell
+4  A: 

According to this link the WaitForExit() method is used to make the current thread wait until the associated process terminates. However, the Process does have an Exited event that you can hook into.

BFree
+4  A: 

process.Exited += [EventHandler]

Timothy Carter
for the record, it appears you must also set `c4_process.EnableRaisingEvents = true`
Dustin Getz