Class: Airflow::SigHandler

Inherits:
Object
  • Object
show all
Includes:
Utils::Logger
Defined in:
lib/async_flow/sig_handler.rb

Constant Summary collapse

SIGNAL_HANDLERS =
{
  "INT" => ->(_subject) { raise Interrupt },
  "TERM" => ->(_subject) { raise Interrupt }
}.freeze

Instance Method Summary collapse

Methods included from Utils::Logger

#logger

Constructor Details

#initialize(subject) ⇒ SigHandler

Returns a new instance of SigHandler.



12
13
14
15
# File 'lib/async_flow/sig_handler.rb', line 12

def initialize(subject)
  @subject = subject
  @read_io, @write_io = IO.pipe
end

Instance Method Details

#callObject



17
18
19
20
21
# File 'lib/async_flow/sig_handler.rb', line 17

def call
  trap
  yield
  wait
end