[Mono-list] Capturing output from Linux Command Line programs

Chris Aitken chris at ion-dreams.com
Tue Aug 16 12:50:57 EDT 2005


> At 01:20 PM 16/08/2005 +0100, Chris Aitken chris-at-ion-dreams.com
> |mono-list subscription| wrote:
> >Tracy,
> >
> >If you need help with this, shout (I wrote it).
> >
> >> public class GACReader
> >> {
> >>         private static void Main()
> >>         {
> >>                 System.Diagnostics.Process GACRead;
> >> 
> >>                 GACRead = new System.Diagnostics.Process();
> >>                 GACRead.StartInfo.FileName = "gacutil";
> >>                 GACRead.StartInfo.Arguments = " -l | grep 
> Version=1";
> >>                 GACRead.StartInfo.UseShellExecute = true;
> >>                 GACRead.StartInfo.RedirectStandardOutput = false;
> 
> Shouldn't this read "... = true;" ?
> 
> >>                 GACRead.Start();
> >> 
> >>                 contents = GACRead.StandardOutput.ReadToEnd();
> >> 
> >>                 GACRead.WaitForExit();
> >>                 GACRead.Close();
> >>         }
> >>         
> >> }


Depends.....
This was for ASP.NET, where I wanted a CLI command to run, and return the
output to the ASP.NET webform.

If I was collecting for std output, then yes - it should = true;


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Mono-list mailing list