File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424class Chef ::Application
2525 include Mixlib ::CLI
2626
27+ class Wakeup < Exception
28+ end
29+
2730 def initialize
2831 super
2932
@@ -46,6 +49,17 @@ def initialize
4649 end
4750 end
4851
52+ unless RUBY_PLATFORM =~ /mswin|mingw32|windows/
53+ trap ( "USR1" ) do
54+ Chef ::Log . info ( "SIGUSR1 received, starting run" )
55+ raise Chef ::Application ::Wakeup
56+ end
57+ end
58+
59+ at_exit do
60+ # tear down the logger
61+ end
62+
4963 # Always switch to a readable directory. Keeps subsequent Dir.chdir() {}
5064 # from failing due to permissions when launched as a less privileged user.
5165 end
Original file line number Diff line number Diff line change @@ -223,6 +223,9 @@ def run_application
223223 else
224224 Chef ::Application . exit! "Exiting" , 0
225225 end
226+ rescue Chef ::Application ::Wakeup => e
227+ Chef ::Log . debug ( "Received Wakeup signal. Starting run." )
228+ next
226229 rescue SystemExit => e
227230 raise
228231 rescue Exception => e
You can’t perform that action at this time.
0 commit comments