I am writing a C# program that launches a program as a new process and tracks its progress by reading from StandardOutput for status reports. I have StandardOutput of that process redirected to a local StreamReader which gets text from it line-at-a-time.
My problem: the ReadLine call to the StreamReader blocks until the process has exited, then spits out all of the lines the program printed all at once. Happens with just using Read to get the first character as well. What would cause this? Is there some option I can set to get it to give me the output while it executes?
//start the rainbow execution engine
ProcessStartInfo psi = new ProcessStartInfo(
psi.WorkingDirectory = "data";
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
extProcess = Process.Start(psi);
StreamWriter input = extProcess.StandardInput;
StreamReader output = extProcess.StandardOutput;
StreamReader error = extProcess.StandardError;
//blocks here w/ no output until program exit
while( (line = output.ReadLine()) != null )