public static void attach(final ProcessHandler processHandler, Project project, String message) {
    ProcessTerminatedListener previousListener = processHandler.getUserData(KEY);
    if (previousListener != null) {
      processHandler.removeProcessListener(previousListener);
      if (project == null) {
        project = previousListener.myProject;
      }
    }

    ProcessTerminatedListener listener = new ProcessTerminatedListener(project, message);
    processHandler.addProcessListener(listener);
    processHandler.putUserData(KEY, listener);
  }
public static void attach(final ProcessHandler processHandler, Project project, String message)