Will the program deadlock if the error stream is not read regularly?

I initially wanted to quickly check the flow of errors from the program right after it starts working successfully.

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.RedirectStandardError = true;
string errortext = Process.StandardError.ReadToEnd();

      

However, I was wondering if I needed to redirect the process standard error back to the file.

I would think that if nothing is read from the std error and the program is writing many errors to the stream, then the buffer will eventually fill up. I don't know exactly how it works ProcessStartInfo.RedirectStandardError

, but my guess is that the buffer will not be automatically written to the file when it is full.

To avoid freezing the program I am reading, should I redirect to a file instead of stderror? and then just read that file in line to check for startup errors?

+3


source to share





All Articles