-
-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Daniel Berger edited this page Jan 10, 2026
·
6 revisions
The proc-wait3 library adds several new methods to Ruby's Process module. These include:
- wait3
- wait4
- waitid
- pause
- sigsend
- getrusage
- getdtablesize
gem install proc-wait3
Note that this is a C extension, and so does require a compiler.
- Linux
- FreeBSD
- OS X
- Solaris
require 'proc/wait3'
pid = fork{
sleep 1
exit 2
}
puts Time.now.to_s
Process.wait3
puts $?.exitstatus # => 2Not all platforms (e.g. MacOS) automatically restart wait3() after an EINTR so you'll have to do it manually:
begin
puts Time.now.to_s
Process.wait3
puts $?.exitstatus # => 2
rescue Errno::EINTR
retry
endAs of version 2.1.0 you shouldn't have to do this.
You can find more sample code under the "examples" directory.