# File lib/puppet/network/server.rb, line 8
 8:     def daemonize
 9:         if pid = fork()
10:             Process.detach(pid)
11:             exit(0)
12:         end
13: 
14:         # Get rid of console logging
15:         Puppet::Util::Log.close(:console)
16: 
17:         Process.setsid
18:         Dir.chdir("/")
19:         begin
20:             $stdin.reopen "/dev/null"
21:             $stdout.reopen "/dev/null", "a"
22:             $stderr.reopen $stdout
23:             Puppet::Util::Log.reopen
24:         rescue => detail
25:             File.open("/tmp/daemonout", "w") { |f|
26:                 f.puts "Could not start %s: %s" % [Puppet[:name], detail]
27:             }
28:             raise "Could not start %s: %s" % [Puppet[:name], detail]
29:         end
30:     end