   killProcess: =>
     return unless @processMap?
     debug "Killing all ghc-modi processes"
-    atom.workspace.getTextEditors().forEach (editor) =>
-      @killProcessForDir @getRootDir(editor.getBuffer())
+    @processMap.forEach (proc) ->
+      proc.kill()
 
   killProcessForDir: (dir) =>
     return unless @processMap?
     debug "Killing ghc-modi process for #{dir.getPath()}"
-    @processMap.get(dir)?.kill?()
-    @processMap.delete(dir)
+    @processMap.get(dir.getPath())?.kill?()
+    @processMap.delete(dir.getPath())
 
   destroy: =>
     return unless @processMap?

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

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

  runModCmd: ({options, command, text, uri, args}) ->
