You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2016/03/24 04:09:03 UTC
[Bug 59228] New: / does not preserve exit status from
on error
https://bz.apache.org/bugzilla/show_bug.cgi?id=59228
Bug ID: 59228
Summary: <ant>/<antcall> does not preserve exit status from
<fail> on error
Product: Ant
Version: 1.9.6
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
Assignee: notifications@ant.apache.org
Reporter: acwwat@gmail.com
The <ant>/<antcall> does not preserve the exit status specified in a <fail>
task when the application exits. Below is a simple test case that illustrates
the problem:
<project name="build" default="t1">
<target name="t1">
<antcall target="t2" />
</target>
<target name="t2">
<fail message="Failing with a 2" status="2" />
</target>
</project>
The expectation is that when Ant exits, the error code (%ERRORLEVEL% on
Windows, $? on UNIX) should be 2. However the observed result is that the error
code is set to 1 instead.
At the code level, this is because
ProjectHelper.addLocationToBuildException(BuildException, Location) always
throws a new BuildException regardless of whether the original exception is an
ExitStatusException. The proposed solution is to check whether the original
exception is an ExitStatusException, and if so, throw a new ExitStatusException
with the status code from the original ExceptionStatusException.
Refer to my pull request on Github for a proposed implementation. If the
original patch submission method is preferred, let me know and I can do that
too.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 59228] / does not preserve exit status from
on error
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59228
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |1.9.7
Status|NEW |RESOLVED
OS| |All
Resolution|--- |FIXED
--- Comment #1 from Stefan Bodewig <bo...@apache.org> ---
Thanks a lot Anthony, I've applied your PR.
--
You are receiving this mail because:
You are the assignee for the bug.