Sha256: 5ec1765ec3265c00a4c4d170075315bf6c074bd52d48577d7ed0b0179f24e05f

Contents?: true

Size: 801 Bytes

Versions: 62

Compression:

Stored size: 801 Bytes

Contents

require 'thread'

module Debugger
  class Interface
  end

  class LocalInterface < Interface
  end


  class RemoteInterface < Interface # :nodoc:
    attr_accessor :command_queue

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

    def print(*args)
      @socket.printf(*args)
    end
    
    def close
      @socket.close
    rescue IOError, SystemCallError
    end

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

  end
  
end

Version data entries

62 entries across 54 versions & 4 rubygems

Version Path
ruby-debug-ide-0.7.2 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.7.1.beta3 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.7.1.beta2 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.7.1.beta1 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.7.0 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-docker-0.6.1 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.7.0.beta7 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.7.0.beta6 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.7.0.beta4 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.7.0.beta3 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.7.0.beta2 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.6.1 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.6.1.beta12 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.6.1.beta11 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.6.1.beta9 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.6.1.beta8 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.6.1.beta7 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.6.1.beta6 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.6.1.beta4 lib/ruby-debug-ide/interface.rb
ruby-debug-ide-0.6.1.beta3 lib/ruby-debug-ide/interface.rb