 {isEqual} = require 'underscore-plus'
 {hook} = require '../../misc'
 basic = require './basic'
+
+IPC = require '../ipc'
 
 module.exports =
 

          .catch (e) =>
            delete @booting
            @removeFromCache path, args, obj
            Promise.reject e
        obj
    return


        (if type == 'stdout' then out else err) data
      delete obj.events

  boot: (ipc) -> ipc.rpc 'ping'
  console: (ipc) -> ipc.rpc 'evalrepl', {code: 'Void()'}
  editor: (ipc) -> ipc.rpc 'eval', {text: '2+2', mod: 'Main', line: 1, path: 'untitled'}
  completions: (ipc) -> ipc.rpc 'cacheCompletions', 'Main'

  warmup: (obj) ->
    obj.init = Promise.resolve()
    obj.proc.socket
      .then (sock) =>
        return unless obj.cached
        ipc = new IPC sock
        [@boot, @console, @editor, @completions].forEach (f) ->
          obj.init = obj.init.then ->
            if obj.cached then f ipc
        obj.init = obj.init
          .catch (err) -> console.warn 'julia warmup error:', err
          .then -> ipc.unreadStream()
        return
      .catch ->

  get: (path, args) ->
    @start path, args
    if (proc = @fromCache path, args) then proc
    else basic.get path, args
