 module.exports =
 class GhcModiProcessReal
   constructor: (@caps) ->
-    @processMap = new WeakMap
-    @bufferDirMap = new WeakMap #TextBuffer -> Directory
+    @processMap = new Map #FilePath -> InteractiveProcess
+    @bufferDirMap = new WeakMap #TextBuffer -> FilePath
     @disposables = new CompositeDisposable
     @disposables.add @emitter = new Emitter
 

  spawnProcess: (rootDir, options) =>
    return unless @processMap?
    return unless atom.config.get('haskell-ghc-mod.enableGhcModi')
    proc = @processMap.get(rootDir)
    debug "Checking for ghc-modi in #{rootDir.getPath()}"
    if proc?
      debug "Found running ghc-modi instance for #{rootDir.getPath()}"

  killProcess: =>
    return unless @processMap?
    debug "Killing all ghc-modi processes"
    @processMap.forEach (proc) ->
      proc.kill()

  killProcessForDir: (dir) =>
    return unless @processMap?
    debug "Killing ghc-modi process for #{dir.getPath()}"
    @processMap.get(dir.getPath())?.kill?()
    @processMap.delete(dir.getPath())

  destroy: =>
    return unless @processMap?
