Recent

Author Topic: AsyncProcess not firing OnReadData event  (Read 25 times)

dugga_doo

  • Newbie
  • Posts: 1
AsyncProcess not firing OnReadData event
« on: Today at 03:51:11 pm »
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.

Code: Pascal  [Select][+][-]
  1.   TForm1 = class(TForm)
  2.     AP1: TAsyncProcess;
  3.     Button1: TButton;
  4.     Memo1: TMemo;
  5.     procedure AP1ReadData(Sender: TObject);
  6.     procedure Button1Click(Sender: TObject);
  7.   private
  8.  
  9.   public
  10.  
  11.   end;
  12.  
  13. var
  14.   Form1: TForm1;
  15.  
  16. implementation
  17.  
  18. {$R *.lfm}
  19.  
  20. { TForm1 }
  21.  
  22. procedure TForm1.Button1Click(Sender: TObject);
  23. begin
  24.   AP1.Executable := '/usr/bin/cat';
  25.   AP1.Parameters.Add('/etc/hosts');
  26.   AP1.Options := [poUsePipes, poStderrToOutPut];
  27.   AP1.Execute;
  28.   while AP1.Running do
  29.   begin
  30.     memo1.Lines.add('Running');
  31.     Sleep(200);
  32.     Application.ProcessMessages;
  33.     memo1.Lines.add('Done');
  34.   end;
  35. end;
  36.  
  37. procedure TForm1.AP1ReadData(Sender: TObject);
  38. begin
  39.   memo1.Lines.add('Read Data Here');
  40. end;

The memo1 contents:

Code: Text  [Select][+][-]
  1. Running
  2. Done

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

 

TinyPortal © 2005-2018