ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey N. Solofnenko" <A.Solofne...@mdl.com>
Subject Re: Exec task's FailOnError switch doesn't work in my script?
Date Thu, 25 Mar 2004 00:57:16 GMT
Sorry it uses a lot of other code, but essentially this is it (in Jython):

import sys
import os
import string
import java

print "Starting test"
cmd=sys.argv[1:]
cmd[0]=cmd[0].replace('/', os.sep).replace('\\', os.sep)
#' 2>&1'
print "Excetung '"+str(cmd)+"'"

F=popen(cmd) # there is no really popen() in Jython 2.1, so I wrote mine
res=0;


while(1):
  line=F.readLine()
  if line is None: break
  print "[test] "+line;
  if (res==0 and line.find('FAIL')>=0):
    res=1
    print ">>> Failed!"

if res==0: print "Test succeeded"
else:
  print "Test failed\n"
  raise "Build failed with error code "+str(res)



Srikrishna.Partha@wellsfargo.com wrote:

>Can you send the code ? 
>
>-----Original Message-----
>From: Alexey N. Solofnenko [mailto:A.Solofnenko@mdl.com] 
>Sent: Wednesday, March 24, 2004 4:51 PM
>To: Ant Users List
>Subject: Re: Exec task's FailOnError switch doesn't work in my script?
>
>cmd.exe does not return error code correctly. I had to write a script
>(launched with <script>) to look for a word FAILED in output in order to
>detect a failure on Windows.
>
>- Alexey.
>
>Sheldon Shi wrote:
>
>  
>
>>I have ant script auto_build.xml that contains the following exec task:
>>
>><project ...>
>>
>>   <target name="someBuild">
>>       <exec executable="someBuild.bat" failonerror="true">
>>           <arg line="arg1 arg2 -Doutput=blah"/>
>>	  </exec>
>>   </target>
>>
>></project>
>>
>>someBuild.bat invokes another build process using build.xml.
>>When someBuild.bat fails, I'd like the overall build to fail. But right 
>>now this script still ends successfully. This is part of the output:
>>
>>someBuild:
>>    ...
>>    [exec]     [javac] 2 errors
>>    [exec] 
>>    [exec] BUILD FAILED
>>    [exec] build.xml:385: Compile failed; see the compiler error 
>>output for details.
>>    [exec] 
>>    [exec] Total time: 7 seconds
>>
>>_nextTarget:
>>
>>BUILD SUCCESSFUL
>>
>>
>>I am using Ant version 1.5. Thanks for help.
>>
>>Sheldon
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional 
>>commands, e-mail: user-help@ant.apache.org
>> 
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
>commands, e-mail: user-help@ant.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message