lib/osbourne/runner.rb
def run
      self_read, self_write = IO.pipe

      %w[INT TERM USR1 TSTP TTIN].each do |sig|
        begin
          trap sig do
            self_write.puts(sig)
          end
        rescue ArgumentError
          puts "Signal #{sig} not supported"
        end
      end

      @launcher = Osbourne::Launcher.new

      begin
        Osbourne.provision_worker_queues
        @launcher.start!

        while readable_io = IO.select([self_read]) # rubocop:disable Lint/AssignmentInCondition
          signal = readable_io.first[0].gets.strip
          handle_signal(signal)
        end
        @launcher.wait!
      rescue Interrupt
        @launcher.stop!
        exit 0
      end
    end
def run
      self_read, self_write = IO.pipe

      %w[INT TERM USR1 TSTP TTIN].each do |sig|
        begin
          trap sig do
            self_write.puts(sig)
          end
        rescue ArgumentError
          puts "Signal #{sig} not supported"
        end
      end

      @launcher = Osbourne::Launcher.new

      begin
        Osbourne.provision_worker_queues
        @launcher.start!

        while readable_io = IO.select([self_read]) # rubocop:disable Lint/AssignmentInCondition
          signal = readable_io.first[0].gets.strip
          handle_signal(signal)
        end
        @launcher.wait!
      rescue Interrupt
        @launcher.stop!
        exit 0
      end
    end
def run self_read , self_write = IO . pipe %w[ INT TERM USR1 TSTP TTIN ] . each do | sig | begin trap sig do self_write . puts ( sig ) end rescue ArgumentError puts "Signal #{sig} not supported" end end @launcher = Osbourne :: Launcher . new begin Osbourne . provision_worker_queues @launcher . start! while readable_io = IO . select ( [ self_read ] ) # rubocop:disable Lint/AssignmentInCondition signal = readable_io . first [ 0 ] . gets . strip handle_signal ( signal ) end @launcher . wait! rescue Interrupt @launcher . stop! exit 0 end end
rubocop:disable Metrics/MethodLength
rubocop : disable Metrics / MethodLength