private Map<String, String> getEscapedEnvironmentVariablesMap(CommandBuilder cmdBuilder) {
    Map<String, String> env = new HashMap<String, String>();
    for (Map.Entry<String, String> entry : cmdBuilder.buildEnvironment().entrySet()) {
      String escapedValue = Util.envVarEscape(entry.getValue());
      env.put(entry.getKey(), escapedValue);
    }
    return env;
  }
Gets the environment variables from the specified {@link CommandBuilder} and escapes certain characters.

@param cmdBuilder        the command builder containing the environment variables.
@return                  the map containing the escaped environment variables.
samza-yarn/src/main/java/org/apache/samza/job/yarn/YarnClusterResourceManager.java