/*
Checks if any of the used variable from process.env is changed
334770
function isAccessedVarChanged(cacheData) {
  for (let key in cacheData.env) {
    if (cacheData.env[key] !== process.env[key]) {
      return true;
    }
  }

  return false;
}
597489
def environment_variables
      global_variables = @config.environment_variables
      process_vars = @config.process_options[@name] ? @config.process_options[@name]['env'] || {} : {}
      process_local_vars = @config.local_process_options[@name] ? @config.local_process_options[@name]['env'] || {} : {}
      global_variables.merge(process_vars.merge(process_local_vars)).each_with_object({}) do |(key, value), hash|
        hash[key.to_s] = value.to_s
      end
    end
890196
function env(file, inject) {
    const envs = {};
    if (!path.isAbsolute(file)) {
        file = path.resolve(process.cwd(), file);
    }
    if (fs.existsSync(file) && fs.lstatSync(file).isFile()) {
        const content = fs.readFileSync(file, 'utf8');
        content.split('\n').forEach(line => {
            const kv = line.match(/^\s*([\w.-]+)\s*=\s*(.*)?\s*$/);
            if (kv) {
                const k = kv[1];
                let v = kv[2] || '';
                if (
                    v &&
                    v.length > 0 &&
                    v.charAt(0) === '"' &&
                    v.charAt(v.length - 1) === '"'
                ) {
                    v = v.replace(/\\n/gm, '\n');
                }
                v = v.replace(/(^['"]|['"]$)/g, '').trim();
                envs[k] = v;
            }
        });
    }

    if (inject) {
        Object.keys(envs).forEach(k => {
            if (!(k in process.env)) {
                process.env[k] = envs[k];
            }
        });
    }

    return envs;
}
118147
def check_environment(self, environment):
        

        non_strings = []
        for (k,v) in environment.items():
            if not isinstance(v, basestring):
                non_strings.append(k)
        if non_strings:
            raise ValueError("The following environment variables are not strings: {}".format(", ".join(non_strings)))
        else:
            return True
880869
function isUsedVariable(variable) {
	            var functionNodes = variable.defs.filter(function(def) {
	                    return def.type === "FunctionName";
	                }).map(function(def) {
	                    return def.node;
	                }),
	                isFunctionDefinition = functionNodes.length > 0,
	                rhsNode = null;
	
	            return variable.references.some(function(ref) {
	                if (isForInRef(ref)) {
	                    return true;
	                }
	
	                var forItself = isReadForItself(ref, rhsNode);
	
	                rhsNode = getRhsNode(ref, rhsNode);
					variable.isread = variable.isread || ref.isRead();
	                return (
	                    ref.isRead() &&
	                    !forItself &&
	                    !(isFunctionDefinition && isSelfReference(ref, functionNodes))
	                ) || (ref.isRead() && forItself);
	            });
	        }
505799
function set(key, val) {
    return process.env[key] = (process.env[key] === undefined ? val : process.env[key]);
}
466943
function isUsedVariable(variable) {
            const functionNodes = getFunctionDefinitions(variable),
                isFunctionDefinition = functionNodes.length > 0;
            let rhsNode = null;

            return variable.references.some(ref => {
                if (isForInRef(ref)) {
                    return true;
                }

                const forItself = isReadForItself(ref, rhsNode);

                rhsNode = getRhsNode(ref, rhsNode);

                return (
                    isReadRef(ref) &&
                    !forItself &&
                    !(isFunctionDefinition && isSelfReference(ref, functionNodes))
                );
            });
        }
100311
def check_env(self, envar, value):
        '''
        '''
        if value is None:
            bot.error('You must export %s to use Discourse' % envar)
            print('https://vsoch.github.io/helpme/helper-discourse')
            sys.exit(1)
267948
private static String replaceEnvVars(final String val) {
        String ret = val;
        final String[] envVars = StringUtils.substringsBetween(ret, "${", "}");
        if (null != envVars) {
            for (int i = 0; i < envVars.length; i++) {
                final String envKey = envVars[i];
                String envVal = System.getenv(envKey);
                if (StringUtils.isBlank(envVal)) {
                    envVal = "";
                }

                ret = StringUtils.replace(ret, "${" + envKey + "}", envVal);
            }
        }

        return ret;
    }
51328
private static function get_process_env_variables() {
		// Ensure we're using the expected `wp` binary
		$bin_dir = getenv( 'WP_CLI_BIN_DIR' ) ?: realpath( __DIR__ . '/../../bin' );
		$vendor_dir = realpath( __DIR__ . '/../../vendor/bin' );
		$path_separator = Utils\is_windows() ? ';' : ':';
		$env = array(
			'PATH' =>  $bin_dir . $path_separator . $vendor_dir . $path_separator . getenv( 'PATH' ),
			'BEHAT_RUN' => 1,
			'HOME' => sys_get_temp_dir() . '/wp-cli-home',
		);
		if ( $config_path = getenv( 'WP_CLI_CONFIG_PATH' ) ) {
			$env['WP_CLI_CONFIG_PATH'] = $config_path;
		}
		if ( $term = getenv( 'TERM' ) ) {
			$env['TERM'] = $term;
		}
		if ( $php_args = getenv( 'WP_CLI_PHP_ARGS' ) ) {
			$env['WP_CLI_PHP_ARGS'] = $php_args;
		}
		if ( $php_used = getenv( 'WP_CLI_PHP_USED' ) ) {
			$env['WP_CLI_PHP_USED'] = $php_used;
		}
		if ( $php = getenv( 'WP_CLI_PHP' ) ) {
			$env['WP_CLI_PHP'] = $php;
		}
		if ( $travis_build_dir = getenv( 'TRAVIS_BUILD_DIR' ) ) {
			$env['TRAVIS_BUILD_DIR'] = $travis_build_dir;
		}
		if ( $github_token = getenv( 'GITHUB_TOKEN' ) ) {
			$env['GITHUB_TOKEN'] = $github_token;
		}
		return $env;
	}
850814
public boolean containsEnvVariables(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    return internalGetEnvVariables().getMap().containsKey(key);
  }
1155400
function autoDetect(env) {
  env = env || defaultEnvironment();
  if (typeof(env.chrome) !== 'undefined' &&
    env.chrome.runtime && env.chrome.runtime.id) {
    if (env.chrome.tabs && env.chrome.tabs.create) {
      return ChromeExtensionFlow;
    } else {
      // Chrome packaged app, not supported yet.
      return null;
    }
  }
  if (typeof(env.window) !== 'undefined' && env.window.navigator) {
    // Browser
    return RedirectFlow;
  }
  if (typeof(env.process) !== 'undefined' && env.process.env) {
    // NodeJS script
    return NativeFlow;
  }
  return null;
}
55622
private Properties getEnvVars()
    {
        Process p = null;
        Properties envVars = new Properties();

        try
        {
            Runtime r = Runtime.getRuntime();
            String OS = System.getProperty("os.name").toLowerCase();

            if (OS.indexOf("windows 9") > -1)
            {
                p = r.exec("command.com /c set");
            }
            else if ((OS.indexOf("nt") > -1) ||
                     (OS.indexOf("windows 2000") > -1) ||
                     (OS.indexOf("windows xp") > -1))
            {
                p = r.exec("cmd.exe /c set");
            }
            else
            {
                // our last hope, we assume Unix (thanks to H. Ware for the fix)
                p = r.exec("env");
            }
            BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line;
            while((line = br.readLine()) != null)
            {
                int idx = line.indexOf('=');
                String key = line.substring(0, idx);
                String value = line.substring(idx + 1);
                envVars.setProperty(key, value);
            }
        }
        catch (Exception ExIgnore)
        {
        }
        return envVars;
    }
770397
private function check_env(){
		if( !is_file($this->config->path_definition_file) ){
			return 'Table definition file is NOT a file (or NOT exists).';
		}
		if( !is_readable($this->config->path_definition_file) ){
			return 'Table definition file is NOT readable.';
		}

		if( !is_dir($this->config->path_cache_dir) ){
			return 'path_cache_dir is NOT a directory (or NOT exists).';
		}
		if( !is_readable($this->config->path_definition_file) ){
			return 'path_cache_dir is NOT readable.';
		}
		if( !is_writable($this->config->path_definition_file) ){
			return 'path_cache_dir is NOT writable.';
		}
		return null;
	}
1165583
protected function skipIfEnvVarIsAlreadyInstalled($env_var)
    {
        if (fp_env($env_var, null) != null) {
            $this->info("The environment variable $env_var already exists in your environment (check .env file).");
            $this->info("Please remove the $env_var an re-execute command. Skipping...");
            die();
        }
    }
1094506
protected function detectRunningInHook()
    {
        $envPrefix = $this->config()->get('service.env_prefix');
        if (getenv($envPrefix . 'PROJECT')
            && basename(getenv('SHELL')) === 'dash'
            && !$this->isTerminal(STDIN)) {
            return true;
        }

        return false;
    }
503659
function (value) {
    const IllegalValue = this.$err.IllegalValue;
    if (typeof value !== 'string') {
      return value;
    }
    const result = value.replace(ENVVAR_PATTERN, function () {
      const varname = arguments[1];
      if (process.env[varname] === undefined) {
        throw new IllegalValue(`Environment variable ${varname} was referenced but not set`);
      }
      return process.env[varname];
    });

    return result;
  }