Troy Laurin wrote:

On 6/24/05, Gary Feldman <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote:
This isn't the right way to call it.  It's equivalent to typing

   osql "-E -S $... < ..."
i.e., putting everything into quotes and passing it as the first argument

Being picky here, but the arg value won't be quoted like this, because
the string already contains quotes.  That said, you're right in that
it's an incorrect usage of arg value=, and should instead be arg
line=.

I should have added "Getting the quotes right is left as an exercise for the reader." :-)

Still being picky, the arguments should be split up further, so "-S"
and "${nameOfDBServer}" are separate arguments (unless they would
normally be quoted into a single argument), or use arg line= again.

You are correct. I go back and forth so much between NAnt and Subversion, which use two different command line conventions, that I often get them mixed up.
My copy of osql indicates that there's an -i option for specifying the
input file.  Can you use that?  That would be the easiest, cleanest way
of doing things.

In the long run, it would make sense for NAnt to provide an attribute
input="..." for this functionality, but it's not there yet.

This wouldn't be too hard to add in the trivial case, reading the
contents of a file and passing as input to the command, but it's only
a small part of what redirection is... much more useful would be to
implement pipes, so you could chain execs, much like you can in the
console.

As an interim measure, it would probably be easier if the <exec> could
detect the use of redirection (|<>) and prepend the command with
either "cmd /c" or "sh", depending on environment... that way, people
could use commands they are familiar with and get the full power of
redirection using NAnt, and it would be easier to port existing
scripts into NAnt in a piece-by-piece fashion.
That might be easier, though I'd certainly like the shell to be configurable. But I don't believe NAnt will ever be a total replacement for shells or scripting languages, nor should it be. If you're running two different programs in a single NAnt exec, then I think it's clearer to just create a script that does it and have NAnt just call that script. A major reason that scripts become unmaintainable is that people don't refactor by extracting functions; the same applies to NAnt.

Gary




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to