[Mono-list] pipe output from rpm

Robert Jordan robertj at gmx.net
Wed Oct 17 07:12:27 EDT 2007


B R wrote:
> Noob question here:
> 
> I want to pipe the output from "rpm -i --test *.rpm" into a text file for 
> parsing (looking at mono dependencies). How would I go about doing that?  
> Thanks

using System;
using System.Diagnostics;

class Test
{
         public static void Main ()
         {
                 ProcessStartInfo psi = new ProcessStartInfo ();
                 psi.FileName = "rpm";
                 psi.Arguments = "-i --test *.rpm";
                 psi.RedirectStandardOutput = true;
                 psi.UseShellExecute = false;

                 Process p =  Process.Start (psi);
                 string ret = p.StandardOutput.ReadToEnd ();
                 p.WaitForExit ();

                 Console.WriteLine (ret);
         }
}

Robert



More information about the Mono-list mailing list