diff options
author | danielsdeleo <dan@getchef.com> | 2014-04-22 19:20:47 -0700 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2014-04-24 09:49:52 -0700 |
commit | bfc0b5a5f5e7cc5255a2bc20b50cc2599ec4d7f6 (patch) | |
tree | 675a7deadde55166f332fdc8ed84fff964e1a848 /lib/chef/application.rb | |
parent | a84653e5f57109e3ac153ef686c9230da19da21d (diff) | |
download | chef-bfc0b5a5f5e7cc5255a2bc20b50cc2599ec4d7f6.tar.gz |
Prevent tests from overriding rspec's trap handler
Otherwise you cannot ctrl-C the tests.
Diffstat (limited to 'lib/chef/application.rb')
-rw-r--r-- | lib/chef/application.rb | 33 |
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 |