code: public void run(
        List<String> command,
        @Nullable Path workingDirectory,
        @Nullable Map<String, String> environment,
        ConsoleListener consoleListener)
        throws InterruptedException, CommandExitException, CommandExecutionException {
      ProcessExecutor processExecutor = processExecutorFactory.newProcessExecutor();
      try {
        int exitCode =
            processExecutor.run(
                command,
                workingDirectory,
                environment,
                streamHandlerFactory.newHandler(consoleListener),
                streamHandlerFactory.newHandler(consoleListener));
        if (exitCode != 0) {
          throw new CommandExitException(exitCode);
        }
      } catch (IOException ex) {
        throw new CommandExecutionException(ex);
      }
    }
docs: Run the command and wait for completion.