 class RubyDebuggerClient
   constructor: () ->
     @client = null
-    @child = null
+    @server = null
     @cmdParser = new XmlParser()
     @cmdParser.on 'command', (command) => @handleCmd(command)
     

  destroy: ->
    # TODO: stop the debugger when closing project/editor & other events (which?). this method seems to only be run on Atom exit?
    @client?.end()
    @child?.kill() # SIGTERM
    # @child?.kill('SIGHUP')



    cmd = [
      rdebugIdeBinPath
      "--debug"
      "--disable-int-handler"
      "--evaluation-timeout 10"
      # "--rubymine-protocol-extensions"
      "--host #{host}"
      "--port #{port}"
      # "--dispatcher-port 61514"
      "--"
      scriptToRun
    ].join(" ")
    
    console.log("running cmd: ", cmd, " in dir: ", projectDir)

    @server = exec(cmd, cwd: projectDir)
    @server.stdout.on 'data', (data) ->
      console.log 'stdout: ' + data
      return
    @server.stderr.on 'data', (data) ->
      console.log 'stdout: ' + data
      return
    @server.on 'close', (code) =>
      console.log 'closing code: ' + code
      @server = null
      return
    
    setTimeout =>
