On Sun, 5 Dec 2021, Anthony Walter via fpc-pascal wrote:
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.
I've never known it to report falsely. Reading 'Running' finally does a WaitPID call and this is a kernel call: Function TProcess.PeekExitStatus : Boolean; var res: cint; begin repeat res:=fpWaitPid(Handle,pcint(@FExitCode),WNOHANG); until (res<>-1) or (fpgeterrno<>ESysEINTR); result:=res=Handle; if peekexitstatus returns true (i.e. the process has exited) then running is set to false. Try running your program under strace strace -f --trace=%process yourprogram (so it only shows process management calls) and see what waitpid returns. Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal