I have the following code:
info = new System.Diagnostics.ProcessStartInfo(\"TheProgram.exe\", String.Join(\" \", args));
info.CreateNoWindow = true;
info.Win
Mark Byers' answer is excellent, but I would just add the following:
The OutputDataReceived
and ErrorDataReceived
delegates need to be removed before the outputWaitHandle
and errorWaitHandle
get disposed. If the process continues to output data after the timeout has been exceeded and then terminates, the outputWaitHandle
and errorWaitHandle
variables will be accessed after being disposed.
(FYI I had to add this caveat as an answer as I couldn't comment on his post.)