1

Possible Duplicate:
Redirect but also display process output stream

 var startInfo=new ProcessStartInfo(java, serverMemoryArguments + " -jar \"" + latestBukkit.info.Name + "\"") 
        { WorkingDirectory = latestBukkit.info.DirectoryName ,

        RedirectStandardError=true,
       // RedirectStandardOutput=true,
        UseShellExecute = false,
         //CreateNoWindow=true,
         ErrorDialog = true,
          ErrorDialogParentHandle=this.Handle,

        };

I want to fork the output, not just redirect it... I want to listen and have it show in the normal window.

Can I?

Community
  • 1
  • 1
Maslow
  • 18,464
  • 20
  • 106
  • 193
  • I don't currently own a console window. this is a winforms app. so I don't think it applies? – Maslow Mar 01 '12 at 22:41
  • No, it still does. Your WinForms app's output will be redirected to "Tee" and Tee will write all messages to it's console AND a file. Isn't that what you wanted? – Ani Mar 02 '12 at 15:10
  • No, I don't want a file, I want a stream, so my app can react without interfering with the console's output to the user. – Maslow Mar 02 '12 at 15:33
  • So write Tee as a Winforms app that both writes the file and replace the Console.Writeline with Listbox.Add or whatever UI call you want to display the message with. Or have your new Tee application rewrite the data to a stream of whatever sort. The link I pointed you to was the general idea behind implementing the solution you need. – Ani Mar 02 '12 at 17:07
  • the process i'm launching has its own console window. I do not wish to interfere with that, up to and including any console text coloring it might be trying to do. I will be launching this process and others. So for the process' console window to be fully preserved, I don't think a tee process in the middle would work. however i did just find `AttachConsole` http://msdn.microsoft.com/en-us/library/ms681952%28v=vs.85%29.aspx that might help – Maslow Mar 02 '12 at 17:16
  • @Mechanicalsnail I want to have a fork copy of a colorized console output, the sheer act of redirecting the output somewhere besides the console loses the color. – Maslow Sep 24 '12 at 14:40
  • @Maslow: On Linux commands often detect whether the output is a terminal, and only then display color by default. To force color, most let you pass a flag `--color=always` or similar. It's probably similar on Windows. – Mechanical snail Sep 24 '12 at 20:04

0 Answers0