ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cory Wandling" <c...@ObjectDynamics.com>
Subject Re: problem with commandlines
Date Thu, 10 Aug 2000 13:55:33 GMT
When I have built things like this I have always used the String[] version
of exec.  Otherwise you have to do what the command line processors on the
OS do - parse looking for quotes and divide the command line up into a
String[].

Are you or someone else planning on redoing the Exec task?

Cory Wandling
Object Dynamics, Inc.

----- Original Message -----
From: Stefan Bodewig <bodewig@bost.de>
To: <ant-dev@jakarta.apache.org>
Sent: Thursday, August 10, 2000 2:45 AM
Subject: Re: problem with commandlines


> >>>>> "BL" == Brian Leonard <brian@brainslug.org> writes:
>
>  BL> Seems they should be quoted in
>  BL> ... types.Commandline.Argument.setValue(String)
>
> No, the issue seems to be more difficult than that. The arguments are
> passed to the subprocess as a String[] and everything you add via
> setValue will take exactly one slot in this array.
>
> If I run the attached ExecArray class on Linux, I get
>
> bodewig@sbodewig ~/jakarta/jakarta-ant >java ExecArray
> Arg 0: 1
> Arg 1: 2
> Arg 2: 3
> Arg 0: 1
> Arg 1: 2 3
> Arg 0: 1
> Arg 1: "2 3"
>
> on Windows NT the result is
>
> bodewig@sbodewig ~/jakarta/jakarta-ant >java ExecArray
> Arg 0: 1
> Arg 1: 2
> Arg 2: 3
> Arg 0: 1
> Arg 1: 2 3
> Arg 0: 1
> Arg 1: 2 3
>
> you see, exactly two arguments are passed to the subprocess - if I use
> quotes around them or not doesn't matter. But I surely don't want the
> quotes to become a literal part of my argument as I would on Linux
> (and this is the correct behavior IMHO) - so I can not blindly add
> quotes.
>
> >From this little experiment I'd say the invoked process is doing
> something wrong with the arguments, not Ant. Maybe the problem lies in
> the antRun scripts?
>
> Anybody more Windows savvy than me, would the following change to
> antRun.bat solve the problem on Win95/98?
>
> ! set PARAMS=%PARAMS% %1
> ! set PARAMS=%PARAMS% "%1"
>
> I'm going to look into the sh version.
>
> Stefan
>
>


Mime
View raw message