in reply to Background process using a system call

Just use:
1 while 0 < wait();