[MonoDevelop] Process with Mono

guybrush.d thera at interfree.it
Mon Nov 15 15:30:52 EST 2010


Ciao,
first thank you very much for your answer, i have already tried that way
some time ago,
and i reply it tonight, i'm sorry but it didn't work (or maybe i cannot make
it work), i've just
copied the junk of code from your link and adapted to my app like this:

....
        void AsyncProcess()
        {
			
            sortProcess.StartInfo.FileName = "ls"; //@"/usr/sbin/slapt-get"; 
	    sortProcess.StartInfo.Arguments = " -la /usr/lib"; //--list";
//--list";
			
            sortProcess.StartInfo.UseShellExecute = false;

            sortProcess.StartInfo.RedirectStandardOutput = true;

            sortProcess.OutputDataReceived += new
DataReceivedEventHandler(SortOutputHandler);
            
            sortProcess.Start();

            sortProcess.BeginOutputReadLine();
            
            sortProcess.WaitForExit();

	    if (numOutputLines > 0)
            {
		textview1.Buffer.Text = textview1.Buffer.Text + sortOutput.ToString();
	    }
	   sortProcess.Close();

	}
		
	void SortOutputHandler(object sendingProcess, DataReceivedEventArgs
outLine)
        {

            if (!String.IsNullOrEmpty(outLine.Data))
            {
                numOutputLines++;

                sortOutput.Append(Environment.NewLine + "[" +
numOutputLines.ToString() + "] - " + outLine.Data);
				
            }
        }
....

and what i get is just the freeze of the application, if i put a break point
on "sortOutput.Append(Enviroment.NewLine+...)
i can read a line of the ouput (it looks the last line of the "ls" command
"655445 byte"), but like i said the
apps is just frozen, and the output has not been displayed on the textview,
i tried to put a breakpoint on the next line
to  "sortProcess.WaitForExit();", but it looks that the process has already
completed and program just stay there without
doing anything! Thanks in advance.

-- 
View this message in context: http://mono.1490590.n4.nabble.com/Process-with-Mono-tp3042268p3043753.html
Sent from the Mono - MonoDevelop IDE mailing list archive at Nabble.com.


More information about the Monodevelop-list mailing list