class Puma::Cluster

def wait_workers

`#term` if needed
loops thru @workers, removing workers that exited, and calling
def wait_workers
  @workers.reject! do |w|
    next false if w.pid.nil?
    begin
      if Process.wait(w.pid, Process::WNOHANG)
        true
      else
        w.term if w.term?
        nil
      end
    rescue Errno::ECHILD
      begin
        Process.kill(0, w.pid)
        # child still alive but has another parent (e.g., using fork_worker)
        w.term if w.term?
        false
      rescue Errno::ESRCH, Errno::EPERM
        true # child is already terminated
      end
    end
  end
end