I was interested in getting more dynamic output from exec commands that run a really long time. I came up with a patch to dump standard output to the screen or output file immediately. Not too up on stream usage so my implementation may be in question so I ask those of you that have more experience to take a look.
This is a simplified version that ignores the option of writing to an output
file:
The use of ReadLine is because using Read was getting the same parts of the
output stream multiple times. If you understand why please let me know. :)
Yes the 10ms wait is a little tight but readline blocks anyways.
while(!process.WaitForExit(10))
{
Log.WriteLine(stdOut.ReadLine());
}
Log.WriteLine(stdOut.ReadToEnd());
(Warning : the attached file is based on a slight older version than what is
in CVS)
ExternalProgramBase.cs
Description: Binary data
