I can't AsyncProcess1 to work correctly. As far as I can tell, OnReadData never fires.
I've tried stripping it right back to basics, like this.
TForm1 = class(TForm)
AP1: TAsyncProcess;
Button1: TButton;
Memo1: TMemo;
procedure AP1ReadData(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
AP1.Executable := '/usr/bin/cat';
AP1.Parameters.Add('/etc/hosts');
AP1.Options := [poUsePipes, poStderrToOutPut];
AP1.Execute;
while AP1.Running do
begin
memo1.Lines.add('Running');
Sleep(200);
Application.ProcessMessages;
memo1.Lines.add('Done');
end;
end;
procedure TForm1.AP1ReadData(Sender: TObject);
begin
memo1.Lines.add('Read Data Here');
end;
The memo1 contents:
As you can see, there are no 'Read Data here' lines, so the event is not firing.
Anyone got any ideas?
Am I missing a compiler option in my Lazarus or Project Options?
Is this some weird Linux/KDE/QT thing?
Operating System: Kubuntu 24.04
KDE Plasma Version: 5.27.12
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13
Kernel Version: 6.8.0-136-generic (64-bit)
Graphics Platform: X11