Skip to content

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

class method

Process.last_status

Process.last_status → Process::Status or nil

Returns the status of the last executed child process in the current thread.

Example
Process.wait Process.spawn("ruby", "-e", "exit 13")
Process.last_status   #=> #<Process::Status: pid 4825 exit 13>

If no child process has ever been executed in the current thread, this returns nil.

Example
Process.last_status   #=> nil
See also .kill .maxgroups .initgroups .maxgroups= also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0