Sha256: 9a6fd55b28cc43877cbf867b0d63cfbe546cab36aa463004911339e0e3c08e83

Contents?: true

Size: 833 Bytes

Versions: 10

Compression:

Stored size: 833 Bytes

Contents

require 'thread'

class TCPSocket
  
  # Workaround for JRuby issue http://jira.codehaus.org/browse/JRUBY-2063
  def non_blocking_gets
    loop do
      result, _, _ = IO.select( [self], nil, nil, 0.2 )
      next unless result
      return result[0].gets
    end
  end
  
end

module Debugger  
  class Interface
  end

  class LocalInterface < Interface
  end


  class RemoteInterface < Interface # :nodoc:
    attr_accessor :command_queue
    attr_accessor :socket

    def initialize(socket)
      @socket = socket
      @command_queue = Queue.new
    end
    
    def read_command
      result = @socket.non_blocking_gets
      raise IOError unless result
      result.chomp
    end

    def print(*args)
      @socket.printf(*args)
    end
    
    def close
      @socket.close
    rescue Exception
    end
    
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby-debug-ide-0.4.22 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.4.21 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.4.21.pre1 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.4.18 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.4.17 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.4.17.beta17 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.4.17.beta16 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.4.17.beta14 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.4.17.beta13 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.4.17.beta12 lib/ruby-debug-ide/interface.rb