You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jose Antonio Pla Rodriguez <pl...@procyonsoluciones.com> on 2007/02/17 08:33:54 UTC
return status problem in ant.bat
Hello list:
I am programming a java application than execute a shell command and
gets the return status, with this value I can know if the process
success (return status equals 0) or failed (return status not equals 0).
The problem is that every time I run the ant program by a call to
ant.bat I always get cero ( 0 ) as return status, even when the build is
halted explicitly (<fail/>) or when are evident errors ( like a
execution of an inexistent target or an inexistent build.xml )
I get this problem in:
Windows XP SP2
Apache ant 1.6.5
I tried version 1.7.0 with seem results
Can some one tell me why the ant.bat always returns a status 0
independently of the result of the build process??
There is any way to know if a build process success or fails??
This is a snippet of my code:
ProcessBuilder pb = new ProcessBuilder(new String[]{"ant","zzzzzzz"});
// task zzzzzzz does not exist.
Process p = pb.start();
int r = p.waitFor(); // <------------------------------ this always
returns 0
if ( r == 0 )
System.out.println("OK");
else
System.out.println("FAILED");
Regards,
Pla.