[Gtk-sharp-list] Gnome app + Shell Command + Threads

Antonio Gutiérrez Mayoral agutierr@gsyc.escet.urjc.es
Mon, 31 Jan 2005 20:28:48 +0100


Hi All:

I have the next problem. I am writing a gnome app... and in a moment I
launch a shell command. I would like to write the output of this command
over a textview widget, at the same time the command is executed. I am
using System.Threads to do this, 

	Thread t = new Thread ( new ThreadStart( this.process_ ) ) ;
	t.Start();	

And I read the standard output in the shell process, 

	p.StartInfo.UseShellExecute = false;
	p.StartInfo.RedirectStandardOutput = true;
	p.StartInfo.RedirectStandardInput = true;
	p.StartInfo.RedirectStandardOutput = true;
	p.StartInfo.CreateNoWindow = true;
			
	p.Start();
			
	while ( (buf1 = p.StandardOutput.ReadLine() ) != null) {
		if (buf1 != null) {
			System.Console.WriteLine(buf1);
			buffer.Text += buf1 + EOF;
		}
		p.Refresh();
	}
	p.WaitForExit();

It doesnt works fine :-( The dialog that contain the textview is
blocked... and I have to pass the mouse over the textview to refresh
it... What's wrong ? Shall I use System.Threads ? The Threads in Gtk are
well-supported?

Thanks All!

-- 
Antonio Gutiérrez Mayoral
Grupo de Sistemas y Comunicaciones <http://gsyc.info>
Universidad Rey Juan Carlos <http://www.urjc.es>