You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Anthony Rodriguez <An...@WeddingChannel.com> on 2001/12/12 00:22:14 UTC

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

Re: pushd and popd

Posted by "Frank E. Weiss" <fr...@well.com>.
I had no trouble with this using ant 1.4. Perhaps it is a JVM problem.

Anthony Rodriguez wrote:

> 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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pushd and popd

Posted by Diane Holt <ho...@yahoo.com>.
--- Anthony Rodriguez <An...@WeddingChannel.com> wrote:
> Has anyone had any luck using the Win 2000 programs, pushd and popd? 

Most likely they're built-ins rather than executables, so you'd need to
exec DOS's command shell, with pushd/popd as args to it.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: pushd and popd

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
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:Anthony@WeddingChannel.com]
> Sent: Wednesday, 12 December 2001 10:22 AM
> To: ant-user@jakarta.apache.org
> 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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>