I have an app which calls another process in a command window and that process has updating stats that output to the console window. I thought this was a fairly simple operation but I can't seem to get it to work. Am I missing something?
string assemblyLocation = Assembly.GetExecutingAssembly().Location;
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo pStart = new System.Diagnostics.ProcessStartInfo();
pStart.RedirectStandardOutput = true;
pStart.UseShellExecute = false;
pStart.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pStart.Arguments = args;
pStart.FileName = assemblyLocation.Substring(0, assemblyLocation.LastIndexOf("\\")) + "\\ffmpeg.exe";
pStart.CreateNoWindow = true;
process.StartInfo = pStart;
bool success = process.Start();
StreamReader streamOutput = process.StandardOutput;
Console.WriteLine(streamOutput.ReadToEnd());
process.WaitForExit();
Ideally what I would like is as the output changes within that process I hit or data comes into the reader that I get events off it.
Any help would be great, I feel like this is a newbie question but seem to be missing something.