Process.OutputDataReceived and ErrorDataReceived come in a different order than console messages.

  • Thread starter Thread starter DoB
  • Start date Start date
D

DoB

Hi,

I am reading the process output and error streams, using:
...
p.OutputDataReceived += new
DataReceivedEventHandler(ConsoleEventHandler);
p.ErrorDataReceived += new
DataReceivedEventHandler(ConsoleEventHandler);
...

The problem is that I would like to receive these events in exactly the same
order in which they would be shown by the console if the streams were not
redirected (in other words: I would like to simulate the console).
Buth they come in a different order: generally, the error messages come
before the output messages and such result is not readable.

How to fix this? Is the StandardError buffered? If so, how to make it
unbuffered?

Regards,
DoB.
 
Back
Top