[Mono-dev] starting process in Linux environment
Hi i'm trying to start a proces in linux but it fails. the problem is the process argument, it doesnt recognize it. Process procNetAdapters = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo(ifconfig); startInfo.Arguments = | grep 'inet addr:'; startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = true; startInfo.CreateNoWindow = true; procNetAdapters.StartInfo = startInfo; procNetAdapters.Start(); using (StreamReader r = procNetAdapters.StandardOutput) { string line; string removedLine; while ((line = r.ReadLine()) != null) { if (!windowList.Contains(ADAPTER: + line)) { windowList.Add(ADAPTER: + line); } } } procNetAdapters.Close(); } -- View this message in context: http://mono.1490590.n4.nabble.com/starting-process-in-Linux-environment-tp4406870p4406870.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] starting process in Linux environment
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. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list