As in the previous question, I answered, maybe even a duplicate. See: Swipe a stream in Debug.Write ()
Here is my answer (slightly modified):
process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.OutputDataReceived += p_OutputDataReceived; process.Start(); process.BeginOutputReadLine();
Then your event handler to retrieve the data.
void p_OutputDataReceived(object sender, DataReceivedEventArgs e) { Console.Write(e.Data); }
Basically, you just need to execute nix WaitForExit (), as this causes your program to freeze until the process terminates.
source share