ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lynne Lawrence <...@visuallink.com>
Subject Re: splitting "arg line" into multiple "arg value"s fails? Unable to execute command
Date Mon, 14 Oct 2002 16:25:52 GMT
Ralf Hauser wrote:

> Hi,
>
> When I do
>     <exec executable="${shCmd}">
>        <arg line='-c "rm  *.??.html"'/>
>     </exec>
> it works fine.
>
> when I do
>     <exec executable="${shCmd}">
>        <arg value='-c '/>
>        <arg value='"rm  '/>
>        <arg value='*.??.html'/>
>        <arg value='"'/>
>     </exec>

Since "rm *.??.html" is a single argument, I suspect you need:

<exec executable="${shCmd}">
    <arg value='-c'/>
    <arg value='rm *.??.html'/>
</exec>

Let ant worry about the space separating the arguments and quoting the second
argument :-)

Lynne Lawrence

>
>      [exec] Current OS is Windows 2000
>      [exec] Executing 'C:\cgywin\bin\bash.exe' with arguments:
>      [exec] '-c '
>      [exec] '"rm  '
>      [exec] '*.??.html'
>      [exec] '"'
>      [exec]
>      [exec] The ' characters around the executable and arguments are
>      [exec] not part of the command.
>
> BUILD FAILED
> file:c:/data/MyDocRalf/build.xml:160: Unable to execute command
>         at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec
> (Execute.java:654)
>         at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:417)
>         at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:428)
>         at
> org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:329)
>         at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:368)
>         at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:250)
>         at org.apache.tools.ant.Task.perform(Task.java:317)
>         at org.apache.tools.ant.Target.execute(Target.java:309)
>         at org.apache.tools.ant.Target.performTasks(Target.java:334)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
>         at org.apache.tools.ant.Main.runBuild(Main.java:610)
>         at org.apache.tools.ant.Main.start(Main.java:196)
>         at org.apache.tools.ant.Main.main(Main.java:235)
> --- Nested Exception ---
> java.lang.IllegalArgumentException
>         at java.lang.Win32Process.<init>(Win32Process.java:40)
>         at java.lang.Runtime.execInternal(Native Method)
>         at java.lang.Runtime.exec(Runtime.java:546)
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.jav
> a:645)
>         at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:417)
>         at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:428)
>         at
> org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:329)
>         at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:368)
>         at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:250)
>         at org.apache.tools.ant.Task.perform(Task.java:317)
>         at org.apache.tools.ant.Target.execute(Target.java:309)
>         at org.apache.tools.ant.Target.performTasks(Target.java:334)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
>         at org.apache.tools.ant.Main.runBuild(Main.java:610)
>         at org.apache.tools.ant.Main.start(Main.java:196)
>         at org.apache.tools.ant.Main.main(Main.java:235)
>
> Total time: 1 second
>
> Any idea why?
>
> I plan to replace the third arg value later with apply's targetfile.
>
> Many thanks in advance!
>
>    Ralf
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


--
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