[
https://issues.apache.org/jira/browse/FELIX-6509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17502121#comment-17502121
]
Grzegorz Grzybek commented on FELIX-6509:
-----------------------------------------
thanks [~gnodet] for comment. Hmm, I'm not sure how to implement some custom
function to replace this fragment:
{code:java}
String s = baos.toString();
while (!s.isEmpty() && s.charAt(s.length() - 1) == '\n') {
s = s.substring(0, s.length() - 1);
}
{code}
IMO, simple {{s.charAt(s.length() - 1) == '\n'}} → {{(s.charAt(s.length() - 1)
== '\n' || s.charAt(s.length() - 1) == '\r')}} change would fix it...
> 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
> Assignee: Guillaume Nodet
> Priority: Major
>
> 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)