public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Added Ruby 1.8 implementation of Process.daemon
josh (author)
Mon May 05 08:22:29 -0700 2008
commit  3cffe92ff066c2b35eef409547db93652c5cccfc
tree    f714643a4043d9fb73b39ec2a114d18f5deeffdd
parent  d75525b045b9f27ed108912a6dbdbad5ab775045
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Added Ruby 1.8 implementation of Process.daemon
0
+
0
 * Duration #since and #ago with no argument (e.g., 5.days.ago) return TimeWithZone when config.time_zone is set. Introducing Time.current, which returns Time.zone.now if config.time_zone is set, otherwise just returns Time.now [Geoff Buesing]
0
 
0
 * Time#since behaves correctly when passed a Duration. Closes #11527 [kemiller]
...
2
3
4
5
6
7
8
9
10
11
12
13
 
14
15
16
 
...
2
3
4
 
 
 
 
 
 
 
 
 
5
6
 
7
8
0
@@ -2,14 +2,6 @@ module Kernel
0
   # Turns the current script into a daemon process that detaches from the console.
0
   # It can be shut down with a TERM signal.
0
   def daemonize
0
- exit if fork # Parent exits, child continues.
0
- Process.setsid # Become session leader.
0
- exit if fork # Zap session leader. See [1].
0
- Dir.chdir "/" # Release old working directory.
0
- File.umask 0000 # Ensure sensible umask. Adjust as needed.
0
- STDIN.reopen "/dev/null" # Free file descriptors and
0
- STDOUT.reopen "/dev/null", "a" # point them somewhere sensible.
0
- STDERR.reopen STDOUT # STDOUT/ERR should better go to a logfile.
0
- trap("TERM") { exit }
0
+ Process.daemon
0
   end
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.