From 3cffe92ff066c2b35eef409547db93652c5cccfc Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 5 May 2008 10:22:29 -0500 Subject: Added Ruby 1.8 implementation of Process.daemon --- .../lib/active_support/core_ext/kernel/daemonizing.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/kernel/daemonizing.rb') diff --git a/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb b/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb index 0e78819fdf..ed9d1f9bf2 100644 --- a/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb +++ b/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb @@ -2,14 +2,6 @@ module Kernel # Turns the current script into a daemon process that detaches from the console. # It can be shut down with a TERM signal. def daemonize - exit if fork # Parent exits, child continues. - Process.setsid # Become session leader. - exit if fork # Zap session leader. See [1]. - Dir.chdir "/" # Release old working directory. - File.umask 0000 # Ensure sensible umask. Adjust as needed. - STDIN.reopen "/dev/null" # Free file descriptors and - STDOUT.reopen "/dev/null", "a" # point them somewhere sensible. - STDERR.reopen STDOUT # STDOUT/ERR should better go to a logfile. - trap("TERM") { exit } + Process.daemon end -end \ No newline at end of file +end -- cgit v1.2.3