Sha256: da7e2d02748face5610f21fb32fcc1e61584a8950c6ed231160483fa5e5e0112

Contents?: true

Size: 379 Bytes

Versions: 1

Compression:

Stored size: 379 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.info("shutdown", handler: block.inspect)
        block.call
        old.call
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
liquid-ext-3.3.7 lib/liquid/ext/signal.rb