Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-6509

Evaluation of subshell String results are wrong on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • gogo.runtime-1.1.6
    • Gogo Runtime
    • None

    Description

      I'm trying this use case (gogo-runtime 1.1.4):

      karaf@root()> "MyTest" toCharArray
      [M, y, T, e, s, t]
      

      and it's fine. However, trying this:

      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,
      

      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:

      String s = baos.toString();
      while (!s.isEmpty() && s.charAt(s.length() - 1) == '\n') {
          s = s.substring(0, s.length() - 1);
      }
      

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

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            ggrzybek Grzegorz Grzybek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: