lib/foreman/engine.rb in foreman-0.83.0 vs lib/foreman/engine.rb in foreman-0.84.0

- old
+ new

@@ -8,11 +8,11 @@ class Foreman::Engine # The signals that the engine cares about. # - HANDLED_SIGNALS = [ :TERM, :INT, :HUP ] + HANDLED_SIGNALS = [ :TERM, :INT, :HUP, :USR1, :USR2 ] attr_reader :env attr_reader :options attr_reader :processes @@ -102,10 +102,12 @@ handle_term_signal when :INT handle_interrupt when :HUP handle_hangup + when *HANDLED_SIGNALS + handle_signal_forward(sig) else system "unhandled signal #{sig}" end end @@ -126,9 +128,14 @@ # Handle a HUP signal # def handle_hangup system "SIGHUP received, starting shutdown" @shutdown = true + end + + def handle_signal_forward(signal) + system "#{signal} received, forwarding it to children" + kill_children signal end # Register a process to be run by this +Engine+ # # @param [String] name A name for this process