Anthony,

What exactly are you trying to achieve?

pushd and popd are builtins to the Windows shell. This is why Ant cannot
execute them directly. The normal way around this would be to actually exec
cmd.exe and ask it to run the built-in.

In your case, however, the pushd and popd commands would only affect the
process that is created for the <exec> operation. Any effect they did have
would be lost when the <exec> completes and would not affect the Ant
process.

Perhaps you can explain why you need to pushd/popd at all and we could
suggest an alternative approach.

Conor



> -----Original Message-----
> From: Anthony Rodriguez [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 12 December 2001 10:22 AM
> To: [EMAIL PROTECTED]
> Subject: pushd and popd
>
>
> Has anyone had any luck using the Win 2000 programs, pushd and popd?  I'm
> trying to use it in my build.xml but it's not working.
>
> build.xml:
> ----------
> <target name="pushpop">
>    <exec executable="pushd">
>        <arg line="\\${server}\${testdir}\"/>
>    </exec>
>    <exec executable="popd"/>
> </target>
>
>
> Here are my results:
> --------------------
> C:\antdir>ant -v init pushpop
>
> Ant version 1.4Beta2 compiled on August 20 2001
> Buildfile: build.xml
> Detected Java version: 1.3 in: c:\jdk1.3.1\jre
> Detected OS: Windows 2000
> parsing buildfile C:\antdir\build.xml with URI = file:C:/antdir/build.xml
> Project base dir set to: C:\antdir
> Property ${classpath} has not been set
> Property ${home} has not been set
> Build sequence for target `init' is [init]
>
> init:
>  [property] Loading C:\antdir\build.properties
> Build sequence for target `pushpop' is [pushpop]
>
> pushpop:
>      [exec] Current OS is Windows 2000
>      [exec] pushd \\nqa2\testdir\
>
> BUILD FAILED
>
> C:\antdir\build.xml:256: Execute failed: java.io.IOException: CreatePro
> cess: pushd \\nqa2\testdir\ error=2
>         at
> org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:281)
>         at
> org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:177)
>         at org.apache.tools.ant.Task.perform(Task.java:217)
>         at org.apache.tools.ant.Target.execute(Target.java:164)
>         at org.apache.tools.ant.Target.performTasks(Target.java:182)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:601)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:560)
>         at org.apache.tools.ant.Main.runBuild(Main.java:454)
>         at org.apache.tools.ant.Main.start(Main.java:153)
>         at org.apache.tools.ant.Main.main(Main.java:176)
> --- Nested Exception ---
> java.io.IOException: CreateProcess: pushd \\nqa2\testdir\ error=2
>         at java.lang.Win32Process.create(Native Method)
>         at java.lang.Win32Process.<init>(Win32Process.java:66)
>         at java.lang.Runtime.execInternal(Native Method)
>         at java.lang.Runtime.exec(Runtime.java:551)
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Exec
> ute.java:564)
>         at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:384)
>         at
> org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:250)
>         at
> org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:279)
>         at
> org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:177)
>         at org.apache.tools.ant.Task.perform(Task.java:217)
>         at org.apache.tools.ant.Target.execute(Target.java:164)
>         at org.apache.tools.ant.Target.performTasks(Target.java:182)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:601)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:560)
>         at org.apache.tools.ant.Main.runBuild(Main.java:454)
>         at org.apache.tools.ant.Main.start(Main.java:153)
>         at org.apache.tools.ant.Main.main(Main.java:176)
>
> Total time: 2 seconds
>
> Any idea what is going wrong here?
>
> -Anthony
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to