we can probably drop this sleep down a fair bit, its ages ago now but I think the sleep 1 was there for combating some weird edge case - probably what you're fixing here.  So we should be able to waitpid more frequently than 1 second in this case I guess?