def script_env(script, args=None):
    cache_key = (script, args)
    stdout = script_env_stdout_cache.get(cache_key, None)
    if stdout is None:
        stdout = common.get_output(script, args)
        script_env_stdout_cache[cache_key] = stdout

    # Stupid batch files do not set return code: we take a look at the
    # beginning of the output for an error message instead
    olines = stdout.splitlines()
    if olines[0].startswith("The specified configuration type is missing"):
        raise BatchFileExecutionError("\n".join(olines[:2]))

    return common.parse_output(stdout)