         new InteractiveProcess(modiPath, [], options, @caps)
     proc.onExit (code) =>
       debug "ghc-modi for #{rootDir.getPath()} ended with #{code}"
-      @processMap?.delete(rootDir)
-    @processMap.set rootDir, proc
+      @processMap?.delete(rootDir.getPath())
+    @processMap.set rootDir.getPath(), proc
     return proc
 
   runModCmd: ({options, command, text, uri, args}) ->

  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()}"

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

