ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Own task. Commandline
Date Tue, 05 Mar 2002 15:48:38 GMT
Look how <exec> deals with args of type <arg value="beforespace after
space">, and you should have your answer. Any arg specified with the value
attribute that contains a space will be double-quoted on the command line
generated. I haven't checked, but the solution might be:

        Commandline commandLine = new Commandline();
        commandLine.setExecutable("cmdclient");
        commandLine.createArgument().setValue("-user");
        commandLine.createArgument().setValue("integrator");
        log("Executing " + commandLine.toString());

--DD

 -----Original Message-----
From: 	Natalia Bello [mailto:NBELLO@isabel.be] 
Sent:	Tuesday, March 05, 2002 8:56 AM
To:	'Ant Users List'
Subject:	Own task. Commandline

Hello! 
I am trying to develop my own task; in this task I need to execute a command
line like this:
cmdclient -user "integrator" -pass "password" ..
that is, i need to set the arguments between double quotes!! 
I have tried some posibilites, but i havent success!
If i try for example
        Commandline commandLine = new Commandline();
        commandLine.setExecutable("cmdclient");
        commandLine.createArgument().setValue("-user \"integrator\"");
        log("Executing " + commandLine.toString());

I get:
   [CBL] Executing cmdclient '-user "integrator"'

or this other
   	Commandline commandLine = new Commandline();
	commandLine.setExecutable("cmdclient");
        	commandLine.createArgument().setLine("-user
\"integrator\"");
            log("Executing " + commandLine.toString()); 
I get:
	 [CBL] Executing cmdclient -user integrator

or:
              Commandline commandLine = new Commandline();
	  commandLine.setExecutable("cmdclient");
	  commandLine.createArgument().setValue("-user");
	  commandLine.createArgument().setValue("\"integrator\"");
              log("Executing " + commandLine.toString()); 

I get again: 
	 [CBL] Executing cmdclient -user integrator

Does anyone now how i can do this?
Thanks in advanced,
Natalia

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message