Bug 61274 - Fail on error with spawn=true
Summary: Fail on error with spawn=true
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2017-07-10 12:40 UTC by Tomas Tulka
Modified: 2017-07-10 12:40 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Tulka 2017-07-10 12:40:30 UTC
When I start a long-running process (such as a database system) with spawn=true I would like to know if the process doesn't crash already on the beginning (for instance the database system didn't start at all due to a blocked port etc).

Ant script can wait for the process in a separate thread and report a failure.

The class org.apache.tools.ant.taskdefs.Execute could be modified like this:

line 524:

new Thread(new Runnable() {
            public void run() {
                try {

                    int returnCode = process.exitValue();

                    if (Execute.isFailure(returnCode)) {
                        if (failOnError) {
                            throw new BuildException(process + " returned: " + returnCode);
                } catch (Exception e) {
                    throw new RuntimeException(e);

Thank you very much for any oppinion!

Tomas Tulka