private static void addIfPresent(@NotNull List<String> commandLine, @NotNull Map<String, String> envs, boolean endWithSemicolon) {
    int index = 0;
    for (Map.Entry<String, String> entry : envs.entrySet()) {
      String key = entry.getKey();
      String value = entry.getValue();
      String quotedString;
      if (Platform.current() != Platform.WINDOWS) {
        quotedString = ShStringUtil.quote(value);
      }
      else {
        String escapedValue = StringUtil.escapeQuotes(value);
        quotedString = StringUtil.containsWhitespaces(value) ? StringUtil.QUOTER.apply(escapedValue) : escapedValue;
      }
      if (endWithSemicolon) {
        String semicolon = "";
        if (index == envs.size() - 1) semicolon = ";";
        commandLine.add("export " + key + "=" + quotedString + semicolon);
      }
      else {
        commandLine.add(key + "=" + quotedString);
      }
      index++;
    }
  }
private static void addIfPresent(@NotNull List<String> commandLine, @NotNull Map<String, String> envs, boolean endWithSemicolon)