Hi guys.

Thanks to all anyway for answering.
I've found two nice solutions to solve my problem.
To be honest I've to mention that what my function receives a paramater which is a PID and the function has to check if that process is still running returning a value. Sorry for any misunderstanding. I agree that my question was ambigous from that point of view.

1. Look at /proc/<PID> as /proc has dr-xr-xr-x permissions, like
if DirectoryExistsUTF8(Format('/proc/%d', [wPID])) then
    MessageDlg('OK', 'process is running', mtInformation, [mbOK], 0)
  else
    MessageDlg('OK', 'process is NOT running', mtError, [mbOK], 0);


2. use kill with signal 0
uses BaseUnix;

  if FpKill(wPID, 0) = 0 then
    MessageDlg('OK', 'FpPid process is running', mtInformation, [mbOK], 0)
  else
    MessageDlg('OK', 'FpPid process is NOT running', mtError, [mbOK], 0);

I guess that solution 2 is the best as it asks immediately the kernel.
Antonio.

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to