ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Rodriguez <Anth...@WeddingChannel.com>
Subject RE: pushd and popd
Date Wed, 12 Dec 2001 18:16:03 GMT
What I'm really trying to acheive here is to map a network path to a drive
letter, then copy files to that path.  The copy utility I'm using was
developed in-house and has trouble with UNC paths.  It has other features
however that are specific and necessary to my environment.  So the idea was
to pushd the UNC path, copy to the new drive that pushd assigns, then popd
when I'm done.
However by reading the various responses, it looks like Ant wouldn't leave
me in the drive that pushd would assign.  Is this correct?  Is there a way
for me to work around this aspect of Ant?   Would I be better served by
writing a .bat file and executing that from Ant?

-Anthony

> -----Original Message-----
> From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
> Sent: Tuesday, December 11, 2001 3:53 PM
> To: Ant Users List
> Subject: RE: pushd and popd
> 
> 
> 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:   
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:ant-user-help@jakarta.apache.org>
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message