Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Process.waitall

Process.waitall → [ [pid1,status1], ...]

Waits for all children, returning an array of pid/status pairs (where status is a Process::Status object).

Example
fork { sleep 0.2; exit 2 }   #=> 27432
fork { sleep 0.1; exit 1 }   #=> 27433
fork {            exit 0 }   #=> 27434
p Process.waitall

produces:

[[30982, #<Process::Status: pid 30982 exit 0>],
 [30979, #<Process::Status: pid 30979 exit 1>],
 [30976, #<Process::Status: pid 30976 exit 2>]]
See also .wait2 .waitpid .wait .waitpid2 also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1