     message.textContent = "Run cmd: " + cmd
     message.addEventListener 'click', =>
       for breakpoint in breakpoints
-        @client.write(cmd + " " + breakpoint + "\n")
+        @runCmd(cmd, breakpoint)
     # message.classList.add('message')
     @element.appendChild(message)
 

exec = require('child_process').exec
net = require('net')

module.exports =
class RubyDebuggerView

        @client = null
        return
    , 5000

  runCmd: (cmd, arg) ->
    if arg
      @client.write(cmd + " " + arg + "\n")
    else
      @client.write(cmd + "\n")

  handleCmd: (xml) ->
    parseString xml, attrkey: 'attrs', (err, result) ->
      # TODO: handle XML-error and unknown XML root-tag
      util = require('util')
      console.log(util.inspect(result, false, null))
      
      root = Object.keys(result)[0]
      
      switch root
        when 'breakpoint'
          file = result.breakpoint.attrs.file
          line = parseInt(result.breakpoint.attrs.line)
          atom.workspace.open(file, initialLine: line)
            .then (editor) -> console.log(editor)
        # case 'suspended'           then
        # case 'exception'           then
        # case 'breakpointAdded'     then
        # case 'catchpointSet'       then
        # case 'variables'           then
        # case 'error'               then
        # case 'message'             then
        # case 'eval'                then
        # case 'processingException' then
        # case 'frames'              then

  # Returns an object that can be retrieved when package is activated
  serialize: ->
