9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/puma/daemon/runner_adapter.rb', line 9
def included(base)
base.class_eval do
attr_reader :options
attr_accessor :has_demonized
end
base.class_eval do
def (mode)
super(mode)
daemonize! if daemon?
end
def daemon?
options[:daemon]
end
def daemonize!
return if has_demonized
log '* Puma Daemon: Demonizing...'
log "* Gem: puma-daemon v#{::Puma::Daemon::VERSION}"
log "* Gem: puma v#{::Puma::Const::VERSION}"
Process.daemon(true, true)
self.has_demonized = true
end
def log(str)
return if str =~ /Ctrl-C/
begin
super(str)
rescue StandardError
puts(str)
end
end
end
end
|