Sha256: e2c9935259235901617cec3475db173b327d900f3d3ca345ad859db8fa3f7bee

Contents?: true

Size: 544 Bytes

Versions: 10

Compression:

Stored size: 544 Bytes

Contents

# Traps all the signals {NAMES} that should be intercepted by a long-running background process.
module CarrotRpc::ServerRunner::Signals
  # CONSTANTS

  # The name of the signals to trap.
  NAMES = %w(HUP INT QUIT TERM).freeze

  # Traps all {NAMES}.
  #
  # @yield [name] Block to call when the signal is trapped.
  # @yieldparam name [String] the name of the signal that was trapped
  # @yieldreturn [void]
  # @return [void]
  def self.trap
    NAMES.each do |name|
      Kernel.trap(name) do
        yield name
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
carrot_rpc-1.2.1 lib/carrot_rpc/server_runner/signals.rb
carrot_rpc-1.2.0 lib/carrot_rpc/server_runner/signals.rb
carrot_rpc-1.1.0 lib/carrot_rpc/server_runner/signals.rb
carrot_rpc-1.0.0 lib/carrot_rpc/server_runner/signals.rb
carrot_rpc-0.8.0 lib/carrot_rpc/server_runner/signals.rb
carrot_rpc-0.7.1 lib/carrot_rpc/server_runner/signals.rb
carrot_rpc-0.7.0 lib/carrot_rpc/server_runner/signals.rb
carrot_rpc-0.6.0 lib/carrot_rpc/server_runner/signals.rb
carrot_rpc-0.5.1 lib/carrot_rpc/server_runner/signals.rb
carrot_rpc-0.5.0 lib/carrot_rpc/server_runner/signals.rb