Module: Signal
- Defined in:
- lib/liquid/ext/signal.rb
Class Method Summary collapse
-
.register_shutdown_handler(&block) ⇒ Object
be cautious with this shutdown handler as it does not guarantee execution of all handlers and swallows exceptions inside handlers.
Class Method Details
.register_shutdown_handler(&block) ⇒ Object
be cautious with this shutdown handler as it does not guarantee execution of all handlers and swallows exceptions inside handlers. Use Shutdown.register_with_handler instead
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/liquid/ext/signal.rb', line 5 def self.register_shutdown_handler(&block) signals = %w(INT TERM) # The signal QUIT is in use by the JVM itself signals << 'QUIT' unless RUBY_PLATFORM == 'java' signals.each do |sig| old = trap(sig) {} trap(sig) do $log.debug("shutdown", handler: block.inspect) block.call old.call end end end |