[fpc-pascal] Incorrect Process startup

Steve Gatenby steveg at nevets.com.au
Sun Nov 6 23:50:55 CET 2016


Intermittantly (but consistantly), my app will run the wrong process 
using either TAsyncProcess or RunCommand.

I understand it will be my bug, just looking for a clue :)

The 'Run' function is within a fpc library.

A loop calls the 'Run' function each second to run a system process (eg 
ls or wmctrl etc) - have tried multiple processes, all do the same.

Symptoms are:

run wmctrl (or other) from the TProcess / RunCommand code
the TProcess instance returns the PID for the new process
read the relevant file under /proc/PID/status - it will intermittently 
show the new process is actually a copy of the caller app.
(meaning: the orig app is called Test1, I try to run wmctrl, I end up 
with 2 copies of Test1 running)

I have found through experimenting:

a pause of 100ms after running the process will fix 80% of cases.

for the other failures, I kill the newly created process, and try again 
(this usually works)

As I said, just looking for ideas (and any such are much appreciated)

i7 8G ram 1T ssd - development only, no heavy background processes

Linux Lubuntu x86 32bit
Lazarus 1.7 r53034:53273M FPC 3.0.0 i386-linux-gtk 2

Thanks - SteveG



More information about the fpc-pascal mailing list