boolean (@NotNull ProcessHandler processHandler, @NotNull String sessionName, @NotNull WaitForProcessTask task) { ProcessCloseConfirmation rc = TerminateRemoteProcessDialog.show(myProject, sessionName, processHandler); if (rc == null) { // cancel return false; } boolean destroyProcess = rc == ProcessCloseConfirmation.TERMINATE; if (destroyProcess) { processHandler.destroyProcess(); } else { processHandler.detachProcess(); } ProgressManager.getInstance().run(task); return true; }