How do I merge Standard Output and Standard Error using System.Process?

  • Thread starter Thread starter Bennett Smith
  • Start date Start date
B

Bennett Smith

Using Win32 API calls I can spawn a process using CreateProcess and have
both hStdOutput and hStdError hooked to the same pipe handle. This causes
the child process to send all output and error text to a single pipe that I
can read.

In .NET the only thing I have found to do anything similar is the properties
RedirectStandardOutput and RedirectStandardError in System.Process which I
set to true and the properties StandardOutput and StandardError from which I
can read. Unfortunately this results in two disjoint streams of text that
are impossible to reassemble into a single useful output listing for the
user.

Is there any way in .NET to cause the System.Process class to use the same
handle for standard output and standard error?

I really don't want to drop back to Win32 API calls, but right now that
seems like my only option.

Thanks

-- Bennett
 
Back
Top