in reply to Re: Re: How do you get PID of a program called using system call?
in thread How do you get PID of a program called using system call?

Good point. I certainly should have checked the return values. There is a large potential bug lying in wait there.

I don't think this would ever fill up the proc table though, The loop is bound by a for (1..4) which means that in the wost case, we would have:

1 parent through the first time (creates 1 child) 1 parent 1 child the second time (creates 2 children) 2 parents 2 children the third time (creates 4 children) 4 parents 4 children the fourth time (creates 8 children)
So at most I see a possible 16 procs being active at once.... of course they might never exit due to the messed up @pids array, but thats another matter.

Again, thanks for the catch.

-Blake