diff options
author | danielsdeleo <dan@opscode.com> | 2013-07-05 15:18:53 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-07-05 15:26:09 -0700 |
commit | 1d7d704c1df4f42627ff0d08bb2b8a4d21782d27 (patch) | |
tree | e7c7e7813ba658e8b55666a167a12a26f454b520 | |
parent | 07ea110f8694b5b3a36fb936e7eaa46a9ce86050 (diff) | |
download | chef-1d7d704c1df4f42627ff0d08bb2b8a4d21782d27.tar.gz |
Exit worker process on INT/TERM
-rw-r--r-- | lib/chef/client.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb index 4a0db4053b..ceb0873079 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -191,12 +191,13 @@ class Chef if(Chef::Config[:client_fork] && Process.respond_to?(:fork) && !Chef::Platform.windows?) Chef::Log.info "Forking chef instance to converge..." pid = fork do + [:INT, :TERM].each {|s| trap(s, "EXIT") } client_solo = Chef::Config[:solo] ? "chef-solo" : "chef-client" $0 = "#{client_solo} worker: ppid=#{Process.ppid};start=#{Time.new.strftime("%R:%S")};" begin Chef::Log.debug "Forked instance now converging" do_run - rescue Exception => e + rescue Exception exit 1 else exit 0 |