-child_process = require 'child_process'
+{BufferedProcess, BufferedNodeProcess} = require('atom')
 path = require 'path'
 fs = require 'fs'
 path = require 'path'

            resolve(data.stdout.join(''))
        else
          resolve(data.stderr.join(''))

  # Due to what we are attempting to do, the only viable solution right now is
  #   XRegExp.


  execNode: (filePath, args = [], options = {}) ->
    throw new Error "Nothing to execute." unless arguments.length
    return @_exec(filePath, args, options, true)

  _exec: (command, args = [], options = {}, isNodeExecutable = false) ->
    options.stream ?= 'stdout'
    return new Promise (resolve, reject) ->
      data = stdout: [], stderr: []
      stdout = (output) -> data.stdout.push(output.toString())
      stderr = (output) -> data.stderr.push(output.toString())
      exit = ->
        if options.stream is 'stdout'
          if data.stderr.length
            reject(data.stderr.join(''))
