Method: Chef::Application#setup_signal_handlers

Defined in:
lib/chef/application.rb

#setup_signal_handlersObject



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/chef/application.rb', line 75

def setup_signal_handlers
  trap("INT") do
    Chef::Application.fatal!("SIGINT received, stopping", Chef::Exceptions::SigInt.new)
  end

  trap("TERM") do
    Chef::Application.fatal!("SIGTERM received, stopping", Chef::Exceptions::SigTerm.new)
  end

  unless ChefUtils.windows?
    trap("QUIT") do
      logger.info("SIGQUIT received, call stack:\n  " + caller.join("\n  "))
    end

    trap("HUP") do
      logger.info("SIGHUP received, reconfiguring")
      reconfigure
    end
  end
end