in reply to system() not waiting

A thing to do would be to fork for every system call and use exec to do your calls. In the parent thread use the wait function. I have written a brief example for this node

Hope this helps,
C-Keen