From: James Edward Gray II Date: 2010-12-19T03:23:54+09:00 Subject: Re: Independent processes On Dec 18, 2010, at 12:10 PM, Tasos Laskos wrote: > I'm having a bit of a problem... > Is there a way to completely detach child processes? > > What I mean is, if I Kernel.fork() a piece of code and then the parent > gets killed I want the child to continue running. > > Does anyone have an idea of how to do that? That's how processes work, with no special action required: $ cat parent_and_child.rb fork do 5.times do puts "Child still running..." sleep 1 end puts "Child exiting." end 2.times do puts "Parent still running..." sleep 1 end puts "Parent exiting." $ ruby parent_and_child.rb Parent still running... Child still running... Parent still running... Child still running... Parent exiting. Child still running... $ Child still running... Child still running... Child exiting. James Edward Gray II