Grzegorz Grzybek created FELIX-6509:
---------------------------------------

             Summary: evaluation of subshell String results are wrong on Windows
                 Key: FELIX-6509
                 URL: https://issues.apache.org/jira/browse/FELIX-6509
             Project: Felix
          Issue Type: Bug
          Components: Gogo Runtime
            Reporter: Grzegorz Grzybek


I'm trying this use case (gogo-runtime 1.1.4):
{noformat}
karaf@root()> "MyTest" toCharArray
[M, y, T, e, s, t]
{noformat}

and it's fine. However, trying this:
{noformat}
karaf@root()> config:property-set -p test test "MyTest"
karaf@root()> config:property-get -p test test
MyTest
karaf@root()> ((config:property-get -p test test)) toCharArray
]M, y, T, e, s, t,
{noformat}

produces weird result. Actually understandable - the {{\r}} is not trimmed from 
the result, so it moves cursor to the beginning of the line, and {{]}} 
overwrites initial {{[}}.

the reason [is this 
loop|https://github.com/apache/felix-dev/blob/org.apache.felix.gogo.runtime-1.1.4/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Closure.java#L388-L390]:
{code:java}
String s = baos.toString();
while (!s.isEmpty() && s.charAt(s.length() - 1) == '\n') {
    s = s.substring(0, s.length() - 1);
}
{code}

it isn't OS aware. {{\r}} should also be removed (probably affects Mac too).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to