Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-07

Problem using TAsyncProcess.OnReadData

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

shoKwave

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;

Reply by email

Micha Nelissen
to shoKwave
shoKwave wrote 6 lines
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.

Windows should work, I think... Qt is probably not implemented yet:

TAsyncProcess.OnReadData relies on AddPipeEventHandler working properly. It should integrate that handle in the main event loop.

Micha

Reply by email