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
process.c
View on GitHub ↗
static VALUE
proc_s_last_status(VALUE mod)
{
return rb_last_status_get();
}
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