# File lib/daemons/daemonize.rb, line 244
  def redirect_io(logfile_name)
    begin; STDIN.reopen "/dev/null"; rescue ::Exception; end       
     
    if logfile_name
      begin
        STDOUT.reopen logfile_name, "a" 
        STDOUT.sync = true
      rescue ::Exception
        begin; STDOUT.reopen "/dev/null"; rescue ::Exception; end
      end
    else
      begin; STDOUT.reopen "/dev/null"; rescue ::Exception; end
    end
    
    begin; STDERR.reopen STDOUT; rescue ::Exception; end
    STDERR.sync = true
  end