[Lazarus] Problem using TAsyncProcess.OnReadData

shoKwave shokwave at gmx.net
Wed Jul 28 19:30:31 CEST 2010


  Hi all,

I'm trying to use TAsyncProcess and got into trouble on other widgetsets 
than GTK2. The code below works fine on Ubuntu 10.04 x64 (GTK2) and 
openSUSE 11.3 i386 (GTK2), but not on openSUSE 11.3 i386 (QT) or 
Windows7 i386.

I played around with the options and other properties, but no message 
were displayed. It seems OnReadData is never fired.

Another thing is, running "fpc" without parameter works. (Other commands 
I tried "svn up", "make all" don't work)

What I'm doing wrong?


Regards
Ingo



(I know the example isn't perfect, but the message should come up, as it 
does on GTK2)

uses ..., Process;

...

procedure TForm1.AsyncProcess1ReadData(Sender: TObject);
var s:String;
     b:DWord;
begin
   s:='';
   b:=AsyncProcess1.NumBytesAvailable;
   if b>0 then
   begin
     setlength(s, b);
     AsyncProcess1.Output.Read(s[1], b);
     ShowMessage(s);
   end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   AsyncProcess1.CommandLine:='fpc -iTO';
   AsyncProcess1.Options:=[poUsePipes, poStderrToOutPut];
   AsyncProcess1.ShowWindow:=swoHIDE;
   AsyncProcess1.Execute;
end;





More information about the Lazarus mailing list