lib/adhearsion/foundation/custom_daemonizer.rb in adhearsion-1.2.6 vs lib/adhearsion/foundation/custom_daemonizer.rb in adhearsion-2.0.0.alpha1
- old
+ new
@@ -15,19 +15,17 @@
retry
end
end
# This method causes the current running process to become a daemon
- def daemonize(log_file='/dev/null')
+ def daemonize(log_file = '/dev/null')
oldmode = 0
srand # Split rand streams between spawning and daemonized process
safefork and exit # Fork and exit from the parent
# Detach from the controlling terminal
- unless sess_id = Process.setsid
- raise 'Cannot detach from controlled terminal'
- end
+ raise 'Cannot detach from controlled terminal' unless sess_id = ::Process.setsid
# Prevent the possibility of acquiring a controlling terminal
if oldmode.zero?
trap 'SIGHUP', 'IGNORE'
exit if pid = safefork
@@ -37,9 +35,9 @@
File.umask 0000 # Ensure sensible umask
STDIN.reopen "/dev/null"
STDOUT.reopen '/dev/null', "a"
STDERR.reopen log_file, "a"
- return oldmode ? sess_id : 0
+ oldmode ? sess_id : 0
end
end
-end
\ No newline at end of file
+end