Method: Chef::Application::Base#setup_signal_handlers

Defined in:
lib/chef/application/base.rb

#setup_signal_handlersObject



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/chef/application/base.rb', line 326

def setup_signal_handlers
  super

  unless Chef::Platform.windows?
    SELF_PIPE.replace IO.pipe

    trap("USR1") do
      Chef::Log.info("SIGUSR1 received, will run now or after the current run")
      SELF_PIPE[1].putc(IMMEDIATE_RUN_SIGNAL) # wakeup master process from select
    end

    # Override the trap setup in the parent so we can avoid running reconfigure during a run
    trap("HUP") do
      Chef::Log.info("SIGHUP received, will reconfigure now or after the current run")
      SELF_PIPE[1].putc(RECONFIGURE_SIGNAL) # wakeup master process from select
    end
  end
end