public static String getCLIFullPath()

in cmake-runner-agent/src/jetbrains/buildServer/cmakerunner/agent/util/OSUtil.java [35:68]


  public static String getCLIFullPath(@NotNull final Map<String, String> environment) throws RunBuildException {
    if (SystemInfo.isWindows) {
      String scriptsRunner = environment.get(SCRIPT_RUNNER_EXE_WIN_KEY);
      if (scriptsRunner == null) for (final String s : environment.keySet()) {
        if (StringUtil.areEqual(s.toUpperCase(), SCRIPT_RUNNER_EXE_WIN_KEY.toUpperCase())) {
          scriptsRunner = environment.get(s);
          break;
        }
      }
      if (scriptsRunner == null) {
        throw new RunBuildException("Cannot locate commands launcher (ensure environment variable '" + SCRIPT_RUNNER_EXE_WIN_KEY + "' set to shell, e.g. 'C:\\Windows\\system32\\cmd.exe')");
      }
      return scriptsRunner;
    } else if (SystemInfo.isUnix) {
      String shell = environment.get(SCRIPT_RUNNER_UNIX_KEY);
      if (shell == null) {
        LOG.info("Environment variable '" + SCRIPT_RUNNER_UNIX_KEY + "' is not found.");
      } else if (!shell.contains("/")) {
        // Seems simple shell name, e.g. 'bash', lets try to resolve.
        shell = FileUtil2.findExecutableByNameInPATH(shell, environment);
        if (shell != null) {
          return shell;
        }
        LOG.info("Cannot resolve " + SCRIPT_RUNNER_UNIX_KEY + " env variable with value '" + environment.get(SCRIPT_RUNNER_UNIX_KEY) + "' into absolute path");
      }
      shell = guessUnixShell(environment);
      if (shell != null) {
        return shell;
      }
      throw new RunBuildException("Cannot locate commands launcher (ensure environment variable '" + SCRIPT_RUNNER_UNIX_KEY + "' set to shell, e.g. '/bin/bash')");
    } else {
      throw new RunBuildException(OS_NOT_SUPPORTED);
    }
  }