< prev index next >

src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java

Print this page
rev 1636 : 8151291: $EXEC yields "unknown command" on Cygwin
Reviewed-by: jlaskey, hannesw, sdama

@@ -2722,17 +2722,14 @@
         if (System.getSecurityManager() == null) {
             // do not fill $ENV if we have a security manager around
             // Retrieve current state of ENV variables.
             env.putAll(System.getenv(), scriptEnv._strict);
 
-            // Some platforms, e.g., Windows, do not define the PWD environment
-            // variable, so that the $ENV.PWD property needs to be explicitly
-            // set.
-            if (!env.containsKey(ScriptingFunctions.PWD_NAME)) {
+            // Set the PWD variable to a value that is guaranteed to be understood
+            // by the underlying platform.
                 env.put(ScriptingFunctions.PWD_NAME, System.getProperty("user.dir"), scriptEnv._strict);
             }
-        }
         addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, env);
 
         // add other special properties for exec support
         addOwnProperty(ScriptingFunctions.OUT_NAME, Attribute.NOT_ENUMERABLE, UNDEFINED);
         addOwnProperty(ScriptingFunctions.ERR_NAME, Attribute.NOT_ENUMERABLE, UNDEFINED);
< prev index next >