[Lazarus] TAsyncProcess.OnTerminate doesn't fire
Tom Lisjac
zikon770 at gmail.com
Sat Oct 11 08:23:28 CEST 2008
The TAsyncProcess option set in the test code below executes and
terminates without leaving a zombie process, but the OnTerminate event
never fires. I've tried a variety of options including just
[poUsePipes,poStderrToOutPut] but have yet to see the OnTerminate
event.
Have I set up this component correctly, or is this a bug?
Thanks,
-Tom
------------
Procedure Tform1.Formcreate(Sender: Tobject);
Begin
Asyncprocess1.OnReadData:=@Readprocdata;
Asyncprocess1.OnTerminate:=@Procterminate;
Asyncprocess1.Options:=Asyncprocess1.Options+[poWaitOnExit,poUsePipes,poStderrToOutPut,poNoconsole,poNewProcessGroup];
End;
Procedure Tform1.Button1click(Sender: Tobject);
Begin
with Asyncprocess1 do
begin
commandline:='ls -la';
currentdirectory:='/tmp';
execute
end;
End;
Procedure Tform1.Readprocdata(Sender: Tobject);
begin
with sender as TAsyncProcess do
begin
edit1.text:=inttostr(NumBytesAvailable);
Memo1.Lines.LoadFromStream(OutPut);
end
End;
Procedure Tform1.Procterminate(Sender: Tobject);
Begin
edit2.text:='async done';
End;
More information about the Lazarus
mailing list