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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top