> > [1] From ProcessImpl.java version 1.32, 06/03/22, > > from my version of JDK 1.6: > > > > StringBuilder cmdbuf = new StringBuilder(80); > > for (int i = 0; i < cmd.length; i++) { > > if (i > 0) { > > cmdbuf.append(' '); > > } > > String s = cmd[i]; > > if (s.indexOf(' ') >= 0 || s.indexOf('\t') >= 0) { > > if (s.charAt(0) != '"') { > > cmdbuf.append('"'); > > cmdbuf.append(s); > > if (s.endsWith("\\")) { > > cmdbuf.append("\\"); > > } > > cmdbuf.append('"'); > > } else if (s.endsWith("\"")) { > > /* The argument has already been quoted. */ > > cmdbuf.append(s); > > } else { > > /* Unmatched quote for the argument. */ > > throw new IllegalArgumentException(); > > } > > } else { > > cmdbuf.append(s); > > } > > } > > That is interesting, it makes the assumption that if the arg > doesn't start with quotes and has whitespace, then it needs > quoting. A simple if crude fix would be to swap the first 2 tests. > > Thanks for looking into it in detail.
Seems like the bug in quoting on windows via java's ProcessImpl is not new. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6550942 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6468220 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6511002 Doesn't seem like they are interested in fixing this one. I managed to put together a workaround that solves the problem for me <exec executable="cmd" failonerror="true" outputproperty="extract.dir.short" > <arg value="/q" /> <arg value="/c" /> <arg value='for %A in ("${build.dir}/extract/msi") do echo %~sfA' /> </exec> Basically gives me the 8.3 path without spaces which avoids the problem altogether. Not the nicest solution, but relatively quick. -- Regards, Darragh Bailey --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org