views:

17

answers:

0

I have a shell program that sends output to standard out and standard error. I am trying to write a program in VB.net which inspects the output in real time and presents summarized information in a GUI. I also want the shell program to continue to display its output in a command prompt as usual. I don't want to just shove the output in a text box because then it seems to lose its color formatting.

I have written code to inspect the output, and it works, but it has the side effect of eliminating the output in the shell window. Here is the code I use to begin redirecting output:

Dim info As New ProcessStartInfo()
info.FileName = "foo.bat"
info.UseShellExecute = False
info.RedirectStandardError = True
info.RedirectStandardOutput = True
revProcess = Process.Start(info)
revProcess.BeginOutputReadLine()
revProcess.BeginErrorReadLine()

And then I have handlers for revProcess.OutputDataReceived, etc. to do my analysis.

Edit: Looks like there was another question for this, but the answers didn't go anywhere: http://stackoverflow.com/questions/2453366/capture-and-display-console-output-at-the-same-time sorry for the repost.