[jboss-cvs] JBossAS SVN: r88843 - projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 13 19:13:24 EDT 2009


Author: mstruk
Date: 2009-05-13 19:13:24 -0400 (Wed, 13 May 2009)
New Revision: 88843

Modified:
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java
Log:
Fixed per-process env var bug - env var expansion occured before env vars were set

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java	2009-05-13 23:10:30 UTC (rev 88842)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java	2009-05-13 23:13:24 UTC (rev 88843)
@@ -883,7 +883,7 @@
 							for (j = 0; j < t.length() && p == null; j++) {
 //log.debug("[SSH] : trying " + psmp);
 								psmp.append(t.charAt(j));
-								p = getEnvProperty(psmp.toString());
+								p = getEnvProperty(cmd, psmp.toString());
 							}
 
 							if (p == null) {
@@ -948,7 +948,7 @@
 		return cmds;
 	}
 
-	private void makeProcess(CmdLines cmdl, Cmd cmd, LinkedList joblist, boolean hasin, boolean hasout, boolean ui) throws ShellException {
+    private void makeProcess(CmdLines cmdl, Cmd cmd, LinkedList joblist, boolean hasin, boolean hasout, boolean ui) throws ShellException {
 
 		String command = cmd.getExec();
 		String exepath = "/bin/" + command;
@@ -1308,6 +1308,13 @@
 		return props._getEnvProperty(name);
 	}
 
+    private String getEnvProperty(Cmd cmd, String name) throws ShellException {
+        Object val = cmd.getEnvironment().get(name);
+        if (val == null)
+            return getEnvProperty(name);
+        else
+            return String.valueOf(val);
+    }
 
 	public String _getEnvProperty(String name) throws ShellException {
         return props._getEnvProperty(name);




More information about the jboss-cvs-commits mailing list