docs: public void waitToFinish(PipelineResult result) {
      pipelinesToCancel.add(result);
      if (!options.as(ExampleOptions.class).getKeepJobsRunning()) {
        addShutdownHook(pipelinesToCancel);
      }
      try {
        result.waitUntilFinish();
      } catch (UnsupportedOperationException e) {
        // Do nothing if the given PipelineResult doesn't support waitUntilFinish(),
        // such as EvaluationResults returned by DirectRunner.
        tearDown();
        printPendingMessages();
      } catch (Exception e) {
        throw new RuntimeException("Failed to wait the pipeline until finish: " + result);
      }
    }