Sha256: 359e655eb311e433f6c19b708fba56c26b9ccc3352df58af29bdc4f41d318550

Contents?: true

Size: 1015 Bytes

Versions: 27

Compression:

Stored size: 1015 Bytes

Contents

# frozen_string_literal: true

require 'polyphony'

if Object.constants.include?(:Reline)
  puts "reline"
  class Reline::ANSI
    def self.select(read_ios = [], write_ios = [], error_ios = [], timeout = nil)
      # p [:select, read_ios, timeout]
      # puts caller.join("\n")
      raise if read_ios.size > 1
      raise if write_ios.size > 0
      raise if error_ios.size > 0

      # p 1
      fiber = Fiber.current
      timer = spin do
        sleep timeout
        fiber.cancel
      end
      # p 2
      read_ios.each do |io|
        # p wait: io
        Polyphony.backend_wait_io(io, false)
        # p :done_wait
        return [io]
      end
      # p 3
    rescue Polyphony::Cancel
      # p :cancel
      return nil
    ensure
      # p :ensure
      timer.stop
      # p :ensure_done      
    end
  end
else
  require_relative './readline'

  # RubyLex patches
  class ::RubyLex
    class TerminateLineInput2 < RuntimeError
    end
    const_set(:TerminateLineInput, TerminateLineInput2)
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
polyphony-0.96 lib/polyphony/adapters/irb.rb
polyphony-0.95 lib/polyphony/adapters/irb.rb
polyphony-0.94 lib/polyphony/adapters/irb.rb
polyphony-0.93 lib/polyphony/adapters/irb.rb
polyphony-0.92 lib/polyphony/adapters/irb.rb
polyphony-0.91 lib/polyphony/adapters/irb.rb
polyphony-0.90 lib/polyphony/adapters/irb.rb
polyphony-0.89 lib/polyphony/adapters/irb.rb
polyphony-0.87 lib/polyphony/adapters/irb.rb
polyphony-0.86 lib/polyphony/adapters/irb.rb
polyphony-0.85 lib/polyphony/adapters/irb.rb
polyphony-0.84.1 lib/polyphony/adapters/irb.rb
polyphony-0.84 lib/polyphony/adapters/irb.rb
polyphony-0.83 lib/polyphony/adapters/irb.rb
polyphony-0.82 lib/polyphony/adapters/irb.rb
polyphony-0.81.1 lib/polyphony/adapters/irb.rb
polyphony-0.81 lib/polyphony/adapters/irb.rb
polyphony-0.80 lib/polyphony/adapters/irb.rb
polyphony-0.79 lib/polyphony/adapters/irb.rb
polyphony-0.78 lib/polyphony/adapters/irb.rb