public ExecResult runProcess()

in runAs-agent/src/main/java/jetbrains/buildServer/runAs/agent/CommandLineExecutorImpl.java [20:59]


  public ExecResult runProcess(@NotNull final CommandLineSetup commandLineSetup, final int executionTimeoutSeconds) throws ExecutionException {
    final GeneralCommandLine cmd = new GeneralCommandLine();
    cmd.setExePath(commandLineSetup.getToolPath());
    for (CommandLineArgument arg: commandLineSetup.getArgs()) {
      cmd.addParameter(arg.getValue());
    }

    try {
      LOG.info("Exec: " + cmd.getCommandLineString());
      final jetbrains.buildServer.CommandLineExecutor executor = new jetbrains.buildServer.CommandLineExecutor(cmd);
      final ExecResult result = executor.runProcess(executionTimeoutSeconds);
      if(LOG.isDebugEnabled()) {
        StringBuilder resultStr = new StringBuilder();
        if (result != null) {
          resultStr.append("exit code: ");
          resultStr.append(result.getExitCode());
          final String[] outLines = result.getOutLines();
          if (outLines != null) {
            resultStr.append("out: ");
            for (String line : outLines) {
              if (!StringUtil.isEmpty(line)) {
                resultStr.append(line);
              }

              resultStr.append(LINE_SEPARATOR);
            }
          }
        } else {
          resultStr.append("has no result");
        }

        LOG.debug("Result: " + resultStr);
      }

      return result;
    }
    catch (RuntimeException ex) {
      throw new ExecutionException(ex.getMessage());
    }
  }