protected boolean askUserAndWait(@NotNull ProcessHandler processHandler, @NotNull String sessionName, @NotNull WaitForProcessTask task) {
    Application application = ApplicationManager.getApplication();
    if (application.isWriteAccessAllowed()) {
      // This might happen from Application.exit(force=true, ...) call.
      // Do not show any UI, destroy the process silently, do not wait for process termination.
      processHandler.destroyProcess();
      LOG.info("Destroying process under write action (name: " + sessionName + ", "
               + processHandler.getClass() + ", " + processHandler + ")");
      return true;
    }
    // Disable instant shutdown to show "Terminating <run configuration name>" dialog awaiting graceful process termination.
    // The dialog provides 'Kill process' action for cases when graceful process termination takes too long.
    return application.getService(InstantShutdown.class).computeWithDisabledInstantShutdown(() -> {
      return doAskUserAndWait(processHandler, sessionName, task);
    });
  }
protected boolean askUserAndWait(@NotNull ProcessHandler processHandler, @NotNull String sessionName, @NotNull WaitForProcessTask task)