private static <T> T executeOrRunTask(@NotNull Function<? super @Nullable ProgressIndicator, ? extends T> commandRunner) {
    if (!ApplicationManager.getApplication().isDispatchThread()) {
      return commandRunner.apply(null);
    }
    return ProgressManager.getInstance().run(new Task.WithResult<>(null, IdeBundle.message("wsl.executing.process"), true) {
      @Override
      protected T compute(@NotNull ProgressIndicator indicator) throws RuntimeException {
        return commandRunner.apply(indicator);
      }
    });
  }
private static <T> T executeOrRunTask(@NotNull Function<? super @Nullable ProgressIndicator, ? extends T> commandRunner)