[Mono-dev] starting process in Linux environment

pattex007 bmwfreak007 at hotmail.com
Tue Feb 21 13:59:19 UTC 2012


thank you for your answer

   Process procNetAdapters = new Process();

                ProcessStartInfo startInfo = new
ProcessStartInfo("/bin/bash");
                startInfo.Arguments = "-c 'ifconfig | grep \\'inet
addr:\\''";
                startInfo.UseShellExecute = false;
                startInfo.RedirectStandardOutput = true;
                startInfo.CreateNoWindow = true;

                procNetAdapters.StartInfo = startInfo;
                procNetAdapters.Start();
                file = new System.IO.StreamWriter(@"c:\" + setLogName +
".log", true);
               
            using (StreamReader r = procNetAdapters.StandardOutput)
                {
                    string line;
                   // string removedLine;
                    while ((line = r.ReadLine()) != null)
                    {
                        file.WriteLine(line);

                    }

                }

            file.Close();
            procNetAdapters.Close();

if i run this i get an error with stacktrace

--
View this message in context: http://mono.1490590.n4.nabble.com/starting-process-in-Linux-environment-tp4406870p4407088.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list