2711 if (System.getSecurityManager() == null) { |
2711 if (System.getSecurityManager() == null) { |
2712 // do not fill $ENV if we have a security manager around |
2712 // do not fill $ENV if we have a security manager around |
2713 // Retrieve current state of ENV variables. |
2713 // Retrieve current state of ENV variables. |
2714 final ScriptObject env = newObject(); |
2714 final ScriptObject env = newObject(); |
2715 env.putAll(System.getenv(), scriptEnv._strict); |
2715 env.putAll(System.getenv(), scriptEnv._strict); |
|
2716 |
|
2717 // Some platforms, e.g., Windows, do not define the PWD environment |
|
2718 // variable, so that the $ENV.PWD property needs to be explicitly |
|
2719 // set. |
|
2720 if (!env.containsKey(ScriptingFunctions.PWD_NAME)) { |
|
2721 env.put(ScriptingFunctions.PWD_NAME, System.getProperty("user.dir"), scriptEnv._strict); |
|
2722 } |
|
2723 |
2716 addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, env); |
2724 addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, env); |
2717 } else { |
2725 } else { |
2718 addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, UNDEFINED); |
2726 addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, UNDEFINED); |
2719 } |
2727 } |
2720 |
2728 |