Looks like the problem is with your make, which doesn't propagate the error code of a nested make failure up the levels, since returning 0, meaning everything's peachy, so <exec> doesn't throw, and thus you don't <catch> anything. --DD
-----Original Message----- From: Nolan Ring [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 3:37 PM To: Ant Users List Subject: Re: trycatch and recursive make Sorry about that. I actually do have failonerror set to false. Here's the snippet of code I ran this time - basically I get the same results: <target name="csrc" depends="init"> <exec executable="make" dir="${csrcDir}" failonerror="${failonerror}" resultproperty="result" > <arg line="-f Makefile.sun CSRC_ROOT=${csrcDir} AGENT_ROOT=${basedir}"/> </exec> <echo message="Resultproperty is: ${result} /> </target> If it fails immediately out of the exec I get: csrc: [exec] make: Makefile: No such file or directory [exec] make: *** No rule to make target `Makefile'. Stop. [exec] Result: 2 [echo] Resultproperty is: 2 Failures at a deeper level: csrc: [exec] make[1]: Entering directory `/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/uagent/src' [exec] make[1]: Leaving directory `/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/uagent/src' [exec] make[1]: Makefile: No such file or directory [exec] make[1]: *** No rule to make target `Makefile'. Stop. [exec] make[1]: Entering directory `/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/arp/server' [exec] make[1]: Makefile: No such file or directory [exec] make[1]: *** No rule to make target `Makefile'. Stop. [exec] make[1]: Leaving directory `/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/arp/server' [echo] Resultproperty is: 0 What I want to do with <catch> is get a uniform message into the logs when we have failures - that makes parsing/manipulating them easier. Thanks again... Nolan Dominique Devienne wrote: >Strange. And without <trycatch>, what do you get? BTW, why can you just use > ><exec executable="make" failonerror="false" resultproperty="result"/> > >What do you really do in <catch>? > >Also, I'm not sure resultproperty is set without failonerror="false"... --DD > >-----Original Message----- >From: Nolan Ring [mailto:[EMAIL PROTECTED]] >Sent: Friday, January 24, 2003 2:28 PM >To: [EMAIL PROTECTED] >Subject: trycatch and recursive make > >Hi, > >As a part of our build process we are exec'ing a call to make ... which, >in turn, calls make, which in turn calls make ... etc, etc, etc. > >If the initial call to make from the build.xml fails trycatch catches >the error and echos the correct message. If, however, make fails >several levels down, trycatch doesn't return the "catch" message. >Is there anyway to capture these errors from exec? > >Here's the build.xml snippet: > > <target name="csrc" depends="init"> > <trycatch> > <try> > <exec executable="make" dir="${csrcDir}" resultproperty="result" > > <arg line="-f Makefile.sun CSRC_ROOT=${csrcDir} >AGENT_ROOT=${basedir}"/> > </exec> > </try> > <catch> > <echo>CAUGHT MAKE FAILURE</echo> > </catch> > > </trycatch> > </target> > >The output if the exec of make fails immediately is the following: > >csrc: > [exec] make: Makefile: No such file or directory > [exec] make: *** No rule to make target `Makefile'. Stop. >[trycatch] Caught exception: exec returned: 2 > [echo] CAUGHT MAKE FAILURE > [echo] Resultproperty is: 0 > >If a failure occurs deeper down in the make structure all I get is the >following: >csrc: > [exec] make[1]: Entering directory >`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/uagent/src' > [exec] make[1]: Makefile: No such file or directory > [exec] make[1]: *** No rule to make target `Makefile'. Stop. > [exec] make[1]: Leaving directory >`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/uagent/src' > [exec] make[1]: Entering directory >`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/arp/server' > [exec] make[1]: Makefile: No such file or directory > [exec] make[1]: Leaving directory >`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/arp/server' > [exec] make[1]: *** No rule to make target `Makefile'. Stop. > [echo] Resultproperty is: 0 > >Thanks for any help. > >Nolan -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
