Commons Exec
  1. Commons Exec
  2. EXEC-36

CommandLine does not work with double quote or single quote correctly

    Details

    • Type: Bug Bug
    • Status: In Progress
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Ubuntu 704, JDK1.6

      Description

      Please review and run the following junit test, either apache ant or apache exec does not handle the qoute in the arguments correctly.

      @Test
      public void shouldHandleTheDoubelQuote() throws Exception

      { String commandline = "./script/jrake cruise:publish_installers " + "INSTALLER_VERSION=unstable_2_1 " + "INSTALLER_PATH=\"/var/lib/ cruise-agent/installers\" " + "INSTALLER_DOWNLOAD_SERVER='something'" + "WITHOUT_HELP_DOC=true"; CommandLine line = CommandLine.parse(commandline); String[] args = line.getArguments(); assertThat(args[0], is("cruise:publish_installers")); assertThat(args[1], is("INSTALLER_VERSION=unstable_2_1")); assertThat(args[2], is("INSTALLER_PATH=\"/var/lib/ cruise-agent/installers\"")); assertThat(args[3], is("INSTALLER_DOWNLOAD_SERVER='something'")); assertThat(args[4], is("WITHOUT_HELP_DOC=true")); }
      1. StringUtils.java
        9 kB
        Alessandro Riva
      2. ExecParseUtilsTest.java
        6 kB
        Siegfried Goeschl
      3. ExecParseUtils.java
        4 kB
        Siegfried Goeschl

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Siegfried Goeschl
            Reporter:
            Kai Hu
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development