1require_relative '../../spec_helper' 2 3describe "Process.ppid" do 4 with_feature :fork do 5 it "returns the process id of the parent of this process" do 6 7 read, write = IO.pipe 8 9 child_pid = Process.fork { 10 read.close 11 write << "#{Process.ppid}\n" 12 write.close 13 exit! 14 } 15 16 write.close 17 pid = read.gets 18 read.close 19 Process.wait(child_pid) 20 pid.to_i.should == Process.pid 21 end 22 end 23end 24