Skip to content
Daniel Berger edited this page Jan 10, 2026 · 6 revisions

Description

The proc-wait3 library adds several new methods to Ruby's Process module. These include:

  • wait3
  • wait4
  • waitid
  • pause
  • sigsend
  • getrusage
  • getdtablesize

Installation

gem install proc-wait3

Note that this is a C extension, and so does require a compiler.

Supported Platforms

  • Linux
  • FreeBSD
  • OS X
  • Solaris

Synopsis

require 'proc/wait3'

pid = fork{
  sleep 1
  exit 2
}

puts Time.now.to_s
Process.wait3
puts $?.exitstatus # => 2

Cross-Platform Concerns

Not 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
end

As of version 2.1.0 you shouldn't have to do this.

More Examples

You can find more sample code under the "examples" directory.

Clone this wiki locally