Module: CarrotRpc::ServerRunner::Signals

Defined in:
lib/carrot_rpc/server_runner/signals.rb

Overview

Traps all the signals NAMES that should be intercepted by a long-running background process.

Constant Summary collapse

NAMES =

The name of the signals to trap.

%w(HUP INT QUIT TERM).freeze

Class Method Summary collapse

Class Method Details

.trap {|name| ... } ⇒ void

This method returns an undefined value.

Traps all NAMES.

Yields:

  • (name)

    Block to call when the signal is trapped.

Yield Parameters:

  • name (String)

    the name of the signal that was trapped

Yield Returns:

  • (void)


14
15
16
17
18
19
20
# File 'lib/carrot_rpc/server_runner/signals.rb', line 14

def self.trap
  NAMES.each do |name|
    Kernel.trap(name) do
      yield name
    end
  end
end