Method: Puppet::Daemon.close_streams
- Defined in:
- lib/puppet/daemon.rb
.close_streams ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Close stdin/stdout/stderr so that we can finish our transition into ‘daemon’ mode.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/puppet/daemon.rb', line 61 def self.close_streams Puppet.debug("Closing streams for daemon mode") begin $stdin.reopen "/dev/null" $stdout.reopen "/dev/null", "a" $stderr.reopen $stdout Puppet::Util::Log.reopen Puppet.debug("Finished closing streams for daemon mode") rescue => detail Puppet.err "Could not start #{Puppet.run_mode.name}: #{detail}" Puppet::Util.replace_file("/tmp/daemonout", 0o644) do |f| f.puts "Could not start #{Puppet.run_mode.name}: #{detail}" end exit(12) end end |