summaryrefslogtreecommitdiff
path: root/lib/chef/application.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/application.rb')
-rw-r--r--lib/chef/application.rb33
1 files changed, 19 insertions, 14 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index a943326d95..1683ed8861 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -35,20 +35,6 @@ class Chef::Application
@chef_client = nil
@chef_client_json = nil
- trap("INT") do
- Chef::Application.fatal!("SIGINT received, stopping", 2)
- end
-
- unless Chef::Platform.windows?
- trap("QUIT") do
- Chef::Log.info("SIGQUIT received, call stack:\n " + caller.join("\n "))
- end
-
- trap("HUP") do
- Chef::Log.info("SIGHUP received, reconfiguring")
- reconfigure
- end
- end
# Always switch to a readable directory. Keeps subsequent Dir.chdir() {}
# from failing due to permissions when launched as a less privileged user.
@@ -62,11 +48,30 @@ class Chef::Application
# Get this party started
def run
+ setup_signal_handlers
reconfigure
setup_application
run_application
end
+ def setup_signal_handlers
+ trap("INT") do
+ Chef::Application.fatal!("SIGINT received, stopping", 2)
+ end
+
+ unless Chef::Platform.windows?
+ trap("QUIT") do
+ Chef::Log.info("SIGQUIT received, call stack:\n " + caller.join("\n "))
+ end
+
+ trap("HUP") do
+ Chef::Log.info("SIGHUP received, reconfiguring")
+ reconfigure
+ end
+ end
+ end
+
+
# Parse configuration (options and config file)
def configure_chef
parse_options