public static void attachDumpListener(final @NotNull RunConfigurationBase configuration, final @NotNull ProcessHandler startedProcess, final @Nullable ExecutionConsole console) {
    if (!configuration.isSaveOutputToFile()) {
      return;
    }

    final File file = getOutputFile(configuration);
    if (file != null) {
      startedProcess.addProcessListener(new ProcessAdapter() {
        private PrintStream myOutput;
        @Override
        public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {
          if (configuration.collectOutputFromProcessHandler() && myOutput != null && outputType != ProcessOutputTypes.SYSTEM) {
            myOutput.print(event.getText());
          }
        }

        @Override
        public void startNotified(@NotNull ProcessEvent event) {
          try {
            myOutput = new PrintStream(new FileOutputStream(file));
          }
          catch (FileNotFoundException ignored) {
          }
          startedProcess.notifyTextAvailable(CONSOLE_OUTPUT_FILE_MESSAGE + FileUtil.toSystemDependentName(file.getAbsolutePath()) + "\n", ProcessOutputTypes.SYSTEM);
        }

        @Override
        public void processTerminated(@NotNull ProcessEvent event) {
          startedProcess.removeProcessListener(this);
          if (myOutput != null) {
            myOutput.close();
          }
        }
      });
      if (console instanceof ConsoleView) {
        ((ConsoleView)console).addMessageFilter(new ShowOutputFileFilter());
      }
    }
  }
public static void attachDumpListener(final @NotNull RunConfigurationBase configuration, final @NotNull ProcessHandler startedProcess, final @Nullable ExecutionConsole console)