ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.fr>
Subject <exec> problem with exit value
Date Fri, 23 Mar 2001 09:20:36 GMT
Hi,

I am trying to use the exec task to call another ant build file in some
other directory (I don't want ot use the <ant> task to do that because I
don't want to inherit any of the properties from the calling build.xml).
However, when the called ant build file fails, the calling build file does
not generate a "build failed" and does not stop.

My settings :

1/ I have used the failonerror attribute in the exec task :

        <exec dir="${out.sample.build.dir}" executable="ant.bat"
failonerror="true">
            <arg line="tests_all"/>
        </exec>

2/ When I manually run the called ant build file it fails and if I type
"echo %ERRORLEVEL%" at the DOS prompt (I am on Windows 2000), it correctly
says "1"

3/ For confirmation, I modified the Ant Main.java class to output the exit
value in the main() method and it effectively does a "System.Exit(1)"

4/ I modified Execute.waitFor() method as follows :

    protected void waitFor(Process process) {
        try {
            process.waitFor();
            System.out.println("Process return value = " +
process.exitValue());
            setExitValue(process.exitValue());
        } catch (InterruptedException e) {}
    }

and it prints "Process return value = 0" !

I am stuck ...
Can you help me to debug this problem ?

Thank you.
Vincent.


Mime
View raw message