class Spec::Rails::SpecServer
def daemonize(pid_file = nil)
def daemonize(pid_file = nil) return yield if $DEBUG pid = Process.fork{ Process.setsid Dir.chdir(RAILS_ROOT) trap("SIGINT"){ exit! 0 } trap("SIGTERM"){ exit! 0 } trap("SIGHUP"){ restart_test_server } File.open("/dev/null"){|f| STDERR.reopen f STDIN.reopen f STDOUT.reopen f } run } puts "spec_server launched (PID: %d)" % pid File.open(pid_file,"w"){|f| f.puts pid } if pid_file exit! 0 end