void (@NotNull RunContentDescriptor descriptor, @NotNull ProcessHandler processHandler, @NotNull BooleanSupplier isUpToDate) { ProcessListener restarterListener = ON_TERMINATION_RESTARTER_KEY.get(processHandler); if (restarterListener != null) { clearRestarterListener(processHandler); } restarterListener = new ProcessAdapter() { @Override public void processTerminated(@NotNull ProcessEvent event) { clearRestarterListener(processHandler); ApplicationManager.getApplication().invokeLater(() -> { if (isAutoTestEnabled(descriptor) && isUpToDate.getAsBoolean()) { restart(descriptor); } }, ModalityState.any()); } }; ON_TERMINATION_RESTARTER_KEY.set(processHandler, restarterListener); processHandler.addProcessListener(restarterListener); }