ANT doesn't get exit code return by a python script
I'm currently using ant for building my java project on a Windows XP machine. I have different tasks defined in the build.xml and one of this is the exec of a Python script for analyzing the application output. I would like to make ANT failing when a particolar tag is discovered by script. I'm trying using:
sys.exit(1)
or
os.system("EXIT 1")
the second one in particular execute the console command EXIT which successfully make the building process failing if executed inside a bath file.Unfortunately ant is not able to reveal the exit code from inside the launched script and goes on normally till the end showing a BUILD SUCCESSFUL message.
the script is called in this way:
<exec dir="${path}/scripts" executable="python">
<arg line='log_analysis.py results.log" ' />
</exec>
thanks for your help
Try this:
<exec dir="${path}/scripts" executable="python" failonerror="true">
<arg line="log_analysis.py results.log" />
</exec>
Ant does not stop the build process if the command exits with a return code signaling failure by default; you have to set failonerror="true"
to do that.
上一篇: 在sql的任务中添加登录?