Sha256: b590945d3c8c70b1091c70c9e0f2ad68c200b59c08e01bab2c06e416917aa1b4

Contents?: true

Size: 380 Bytes

Versions: 8

Compression:

Stored size: 380 Bytes

Contents

module Signal
  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
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
liquid-ext-3.5.2 lib/liquid/ext/signal.rb
liquid-ext-3.5.0 lib/liquid/ext/signal.rb
liquid-ext-3.4.2 lib/liquid/ext/signal.rb
liquid-ext-3.4.1 lib/liquid/ext/signal.rb
liquid-ext-3.4.0 lib/liquid/ext/signal.rb
liquid-ext-3.3.10 lib/liquid/ext/signal.rb
liquid-ext-3.3.9 lib/liquid/ext/signal.rb
liquid-ext-3.3.8 lib/liquid/ext/signal.rb