FELIX-1520: <> evaluated the command too many times

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@807496 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
index 211fecf..b9625c6 100644
--- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
+++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
@@ -128,6 +128,11 @@
             System.err.println(buf);
         }
 
+        if (statement.size() == 1 && statement.get(0).charAt(0) == '<')
+        {
+            return eval(statement.get(0));
+        }
+
         Object result;
         List<Object> values = new ArrayList<Object>();
         for (CharSequence token : statement)
diff --git a/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java b/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
index a4403a1..0ffdc98 100644
--- a/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
+++ b/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
@@ -35,6 +35,16 @@
 {
     int beentheredonethat = 0;
 
+    public void testEvaluatation() throws Exception {
+        Context c = new Context();
+        c.addCommand("echo", this);
+        c.addCommand("capture", this);
+
+        assertEquals("a", c.execute("echo a | capture"));
+        assertEquals("a", c.execute("<echo a> | capture"));
+        assertEquals("a", c.execute("<<echo a>> | capture"));
+    }
+
     public void testSpecialValues() throws Exception {
         Context c = new Context();
         assertEquals(false, c.execute("false"));