The exec task is always problematic because you are leaving the ant/java world and entering into an alien space. Not only are there variations between OSes, but individual commands on the same OS behave differently. No matter how many times I use it, I end up having to try different combinations of exec attributes and elements and use the debug and verbose switches.
Note that Windows is not even consistent interpreting imbedded blanks in directory and file names. Try the following from the C:\ prompt. dir program files cd program files -----Original Message----- From: Rhino [mailto:[EMAIL PROTECTED] Sent: Monday, January 30, 2006 3:29 PM To: Ant Users List Subject: Re: Problems with exec task ----- Original Message ----- From: "Steve Loughran" <[EMAIL PROTECTED]> To: "Ant Users List" <user@ant.apache.org> Sent: Monday, January 30, 2006 2:35 PM Subject: Re: Problems with exec task [snip] >> >> Does the Ant manual mention that you can handle embedded blanks in a path >> with a pair of single quotes? I don't recall ever seeing that mentioned >> but the manual isn't searchable so I can't just search for all >> occurrences of "embedded blanks" to verify that. Perhaps it is in the >> manual somewhere but I just missed it. If that fact isn't in the manual >> somewhere, it certainly ought to be, in my opinion. Many many Ant users >> stand a good chance of encountering that problem at some point so the >> single quote technique really needs to be in the manual. > > Well, there is the bit that says > > "It is highly recommended to avoid the line version when possible. Ant > will try to split the command line in a way similar to what a (Unix) shell > would do, but may create something that is very different from what you > expect under some circumstances." > > If you go > > <arg value="${vbs.script}"/> > <arg value="Dudley"/> > <arg value="Doright"/> > > you get exactly what you need, no surprises. > Yes, I saw the bit about preferring several args, each with the value parameter, over one arg with the line parameter but in my various experiments they both behaved the same in each case. But I'm quite happy to use arg with value rather than arg with line if that is more likely to behave in some cases. But your specific example doesn't work; I just tried it. When I did this: <property name="vbs.script" value="'c:\Documents and Settings\Rhino\My Documents\LaunchWdMacro.vbs'"/> <exec executable="cscript.exe" spawn="true"> <arg line="${vbs.script} Dudley Doright"/> </exec> everything was fine; there were no errors from Ant and the macro wrote Dudley Doright in the document. But when I did this (using the same property definition for vbs.script): <exec executable="cscript.exe" spawn="true"> <arg value="${vbs.script}"/> <arg value="Bugs"/> <arg value="Bunny"/> </exec> I got no errors from Ant but the macro didn't run and Bugs Bunny was not added to the document. When I tried the same thing with the spawn="true" removed, I got an error from Ant: [exec] Microsoft (R) Windows Script Host Version 5.6 [exec] Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. [exec] Input Error: There is no script engine for file extension ".vbs'". [exec] Result: 1 Frankly, I'm not sure why these variations don't work but I've got other problems on my plate and the first variant in this note works fine so I'm inclined to move on to other things rather than work out exactly why the variants are failing. > >> If it _is_ in the manual, could someone tell me where it is? If it >> _isn't_ in the manual, what is the appropriate way of asking the Ant >> developers to add it to the manual? >> > > You add it to the manual in your local copy, and submit the patch. We > welcome extra details and examples on things like exec > So are you saying that the information about a pair of single quotes around a path with embedded blanks being helpful is not already in the manual somewhere? Hmm. I'd fully expected to be told that it was already there somewhere, probably with a citation describing exactly where, and that I had simply missed it. Well, if it's not already there, then I feel it should be added to the manual. The only thing is, I'm not sure where to put it. I assume that this is a fairly global gotcha, not something that is only a factor in the exec task. In that case, I think it needs to be located where users of _any_ task might hope to find it. What do you think about adding it to the Feedback and Troubleshooting page? That seems like a fairly logical place to me. There are already a few general suggestions there of roughly the same nature as the single-quotes-around-the-path-with-embedded-blanks technique. If that sounds suitable, I could add another item to the numbered list on that page, then send the HTML source for that page to the developers list; is that the best way to proceed? -- Rhino -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 27/01/2006 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]