code: public String runCommand(List<String> args)
        throws CloudSdkNotFoundException, IOException, ProcessHandlerException {
      sdk.validateCloudSdkLocation();
  
      StringBuilderProcessOutputLineListener stdOutListener =
          StringBuilderProcessOutputLineListener.newListener();
      StringBuilderProcessOutputLineListener stdErrListener =
          StringBuilderProcessOutputLineListener.newListenerWithNewlines();
      ExitCodeRecorderProcessExitListener exitListener = new ExitCodeRecorderProcessExitListener();
  
      // build and run the command
      List<String> command =
          new ImmutableList.Builder<String>()
              .add(sdk.getGCloudPath().toAbsolutePath().toString())
              .addAll(args)
              .build();
  
      Process process = new ProcessBuilder(command).start();
      LegacyProcessHandler.builder()
          .addStdOutLineListener(stdOutListener)
          .addStdErrLineListener(stdErrListener)
          .setExitListener(exitListener)
          .build()
          .handleProcess(process);
  
      if (exitListener.getMostRecentExitCode() != null
          && !exitListener.getMostRecentExitCode().equals(0)) {
        Logger.getLogger(Gcloud.class.getName()).severe(stdErrListener.toString());
        throw new ProcessHandlerException(
            "Process exited unsuccessfully with code " + exitListener.getMostRecentExitCode());
      }
  
      return stdOutListener.toString();
    }
docs: Run short lived gcloud commands.
  
  @param args the arguments to gcloud command (not including 'gcloud')
  @return standard out collected as a single string