[fpc-pascal] TProcess Running is unreliable on Linux

Anthony Walter sysrpl at gmail.com
Sun Dec 5 07:04:26 CET 2021


On Linux using 3.3.1 build of FPC I've found that in many situations the
Running property of TProcess is unreliable. Is this a problem with
which anyone is familiar? I've searched around and haven't found any
discussions related to this problem.

In my experience, I've found situations where the Running property always
returns True even when the process spawned by TProcess is definitely not
running. As an example, I have a timer component checking every 100ms if a
'/bin/bash' process I launched and am using with redirection of input /
ouput pipes has exited.

procedure TMyForm.MyTimerTimer(Sender: TObject);
begin
  if not MyProcess.Running then
    Close;
end;

And is some cases even though I am sure the bash instance associated with
MyProcess has exited, the above code will never close the form. I do not
even have to do with the bash instance. I can just wait 1 minute, close it,
and MyProcess still thinks it's running. This happens occasionally and
randomly and is a bit frustrating to deal with.

Any insight as to what is happening would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20211205/d9074805/attachment.htm>


More information about the fpc-pascal mailing list