On Tue, 22 Aug 2000, Dave Thomas wrote:

> Brian Fundakowski Feldman <green / FreeBSD.org> writes:
> 
> > If your system uses the rb_waitpid() codepath of rb_f_wait(),
> > Process.wait will return prematurely if you have multiple child
> > processes.  The problem is that rb_waitpid() is called only once,
> > when it needs to be called until a you get an ECHILD error from
> > rb_waitpid().
> 
> Perhaps it's late and I should waiting until morning before posting,
> but...
> 
> I'm not sure I see the problem. Process.wait waits for _a_ child to
> terminate, not all children. Your patch seems to reap them all.

That's what I expected Process.wait to do :(  That's how Bourne/Korn
shells do it.  Perhaps then there should just be a Process.waitall;
this is an important primitive.  It smells like a real hack to do

pid = -1
while true
	begin
		npid = Process.wait
	ensure
		break if $!.is_a?(Errno::ECHILD)
		raise $!
	end
	pid = npid
end

or something when shells already provide the ability.

> Regards
> 
> 
> Dave

--
 Brian Fundakowski Feldman           \  FreeBSD: The Power to Serve!  /
 green / FreeBSD.org                    `------------------------------'