Fair enough, there probably is no "one size fits all" solution in this case.
Still, I'd hate to leave people to flounder with only the handful of
examples in the current 'exec' article in the manual; they simply aren't
much help. People can always post to the list and eventually sort out their
problems that way but I wonder if we couldn't do more in the manual to at
least give them a head start.
Maybe a good collection of examples will give them some ideas about how to
solve the problem on their own. I don't think we can come up with an example
of every common scenario but maybe some kind of numbered list that explains
how to figure out what needs to be in the 'exec' would help. For instance,
it never occurred to me that I'd need anything other than 'cmd.exe' as the
executable; I'd never heard of 'cscript.exe'.
I'm not sure how to brainstorm this kind of thing on the list but I feel
like we should perhaps do some form of brainstorming to figure out the best
way to communicate a problem-solving methodology for the 'exec' task without
scaring people away. If we put our heads together, we can probably come up
with something that works for many people.
Any thoughts on how we could brainstorm this? It needn't take much time but
I'd like to do something to keep other people from having big problems with
exec if we possibly can.
---
Rhino
----- Original Message -----
From: "Dick, Brian E." <[EMAIL PROTECTED]>
To: "Ant Users List" <user@ant.apache.org>
Sent: Monday, January 30, 2006 3:46 PM
Subject: RE: Problems with exec task
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]
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 27/01/2006
--
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]