# File lib/thin/daemonizing.rb, line 36 def daemonize raise PlatformNotSupported, 'Daemonizing is not supported on Windows' if Thin.win? raise ArgumentError, 'You must specify a pid_file to daemonize' unless @pid_file remove_stale_pid_file pwd = Dir.pwd # Current directory is changed during daemonization, so store it # HACK we need to create the directory before daemonization to prevent a bug under 1.9 # ignoring all signals when the directory is created after daemonization. FileUtils.mkdir_p File.dirname(@pid_file) Daemonize.daemonize(File.expand_path(@log_file), name) Dir.chdir(pwd) write_pid_file at_exit do log ">> Exiting!" remove_pid_file end end