module Daemonize

Public Instance Methods

safefork() click to toggle source
# File lib/swee/daemonize.rb, line 2
def safefork
  tryagain = true

  while tryagain
    tryagain = false
    begin
      if pid = fork
        return pid
      end
    rescue Errno::EWOULDBLOCK
      sleep 5
      tryagain = true
    end
  end
end