# File lib/phusion_passenger/utils.rb, line 461 def safe_fork(current_location = self.class, double_fork = false) pid = fork if pid.nil? has_exception = false begin if double_fork pid2 = fork if pid2.nil? srand yield end else srand yield end rescue Exception => e has_exception = true print_exception(current_location.to_s, e) ensure exit!(has_exception ? 1 : 0) end else if double_fork Process.waitpid(pid) rescue nil return pid else return pid end end end