private static @Nullable String exec(String errorMessage, String... command) {
    if (command.length == 0) {
      LOG.error(errorMessage, "No command provided");
      return null;
    }

    if (unsupportedCommands.containsKey(command[0])) {
      // Avoid running and logging unsupported commands
      return null;
    }

    try {
      Process process = new ProcessBuilder(command).start();
      if (!process.waitFor(5, TimeUnit.SECONDS)) {
        LOG.info(errorMessage + ": timeout");
        process.destroyForcibly();
        return null;
      }

      if (process.exitValue() != 0) {
        LOG.info(errorMessage + ": exit code " + process.exitValue());
        return null;
      }

      return FileUtil.loadTextAndClose(process.getInputStream()).trim();
    }
    catch (Exception e) {
      LOG.info(errorMessage, e);

      if (e.getMessage().contains("No such file or directory")) {
        unsupportedCommands.put(command[0], true);
      }

      return null;
    }
  }
private static @Nullable String exec(String errorMessage, String... command)