I’ve seen many a question on stackoverflow and other places about running a process and capturing it’s output. Using the System.Diagnostics.Process correctly is not easy and most often it’s done wrong. Some common mistakes with System.Diagnostics.Process: Not capturing both output streams (error & output) Not redirecting input can cause applications to hang Not closing redirected [...]

 

Let’s face it, using the System.Diagnostics.Process to run a process and capture the output is not as easy as it should be. People often get it wrong without realizing it. Adding to the complexities can be reading both the standard output as well as the standard error stream. To put this to bed once and [...]