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 2017/07/10 12:40:30 UTC

[Bug 61274] New: Fail on error with spawn=true

https://bz.apache.org/bugzilla/show_bug.cgi?id=61274

            Bug ID: 61274
           Summary: Fail on error with spawn=true
           Product: Ant
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: tomas.tulka@gmail.com
  Target Milestone: ---

Hi,
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 {
                    process.waitFor();

                    int returnCode = process.exitValue();

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

Thank you very much for any oppinion!

Tomas Tulka

-- 
You are receiving this mail because:
You are the assignee for the bug.