File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -8,20 +8,22 @@ def runas_daemon(argv)
88 $mode = :daemon
99
1010 # daemonize
11- Process . daemon ( false , true ) unless ARGV . include? ( '--foreground' )
11+ unless ARGV . include? ( '--foreground' )
12+ Process . daemon ( false , true )
1213
13- Process . setproctitle ( 'crew-sudo daemon process' )
14+ # redirect output to log
15+ $log = File . open ( DAEMON_LOG_PATH , 'w' )
1416
15- warn "crew-sudo: Daemon started with PID #{ Process . pid } "
17+ $stdin. reopen ( '/dev/null' )
18+ $stdout. reopen ( $log)
19+ $stderr. reopen ( $log)
1620
17- # redirect output to log
18- $log = File . open ( DAEMON_LOG_PATH , 'w' )
21+ [ $log , $stdout , $stderr ] . each { | io | io . sync = true }
22+ end
1923
20- $stdin. reopen ( '/dev/null' )
21- $stdout. reopen ( $log)
22- $stderr. reopen ( $log)
24+ Process . setproctitle ( 'crew-sudo daemon process' )
2325
24- [ $log , $stdout , $stderr ] . each { | io | io . sync = true }
26+ warn "crew-sudo: Daemon started with PID #{ Process . pid } "
2527
2628 if Process . uid . zero?
2729 message 'Daemon running with root permission.'
@@ -105,4 +107,4 @@ def runas_daemon(argv)
105107ensure
106108 @server . close
107109 File . delete ( SOCKET_PATH ) if File . exist? ( SOCKET_PATH )
108- end
110+ end
You can’t perform that action at this time.
0 commit comments