End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Process.ppid
Process.ppid → integer
process.c
View on GitHub ↗
static VALUE
proc_get_ppid(VALUE _)
{
return get_ppid();
}
Returns the process id of the parent of this process. Returns untrustworthy value on Win32/64. Not available on all platforms.
Example
puts "I am #{Process.pid}" Process.fork { puts "Dad is #{Process.ppid}" }
produces:
Example
I am 27417 Dad is 27417