Hans,

On Tue, Oct 7, 2008 at 12:20 AM, Victor Ott
<[EMAIL PROTECTED]> wrote:
> On Mon, Oct 6, 2008 at 9:38 PM, Hans Dockter <[EMAIL PROTECTED]> wrote:
> [...]
>> This is interesting. I wanted to write that we have tried all this and it
>> was of no avail (see http://jira.codehaus.org/browse/GRADLE-58). But in fact
>> it seems to work yet certain things are still confusing to me.
>>
>> If I call from my shell 'ant unknownTask', calling echo %ERRORLEVEL%
>> afterwards give me 1. If I do the following, an exit value of 0 is printed
>> by this Groovy script.
>>
>> String command = 'ant unknownTask'
>> ByteArrayOutputStream outStream = new ByteArrayOutputStream()
>> ByteArrayOutputStream errStream = new ByteArrayOutputStream()
>> Process proc = ['cmd', '/c', command].execute()
>> proc.consumeProcessOutput(outStream, errStream)
>> proc.waitFor()
>> String output = outStream
>> String error = errStream
>> println proc.exitValue()
>> println "Output"
>> println output
>> println "Error"
>> println error
> [...]
>
> Oh no, not ant... that is black magic. ~ four years ago I tried (under
> WinXP) to retrieve reliably the result code from ant, without success.
> I'll take a look tomorrow on it, as I'm on OSX now. Maybe ant has
> improved in the meantime, maybe I've learned more magic in the
> meantime.
>
> PS
> I've downloaded ant 1.7.1, looked at ant.bat and it hasn't improved.
> Tomorrow more.
> Beware: ant.cmd from ant distribution is for OS/2, not Windows!

This is a ANT issue. See e.g.
http://continuum.apache.org/faqs.html#how-does-continuum-detect-a-successful-build-with-ant
I've added a line "exit %ANT_ERROR%" to end of "ant.bat", so it looks
now like this:
===============
[...]
:omega

exit %ANT_ERROR%
===============

This gives following result of your above Groovy test script:
======================
D:\java\tools\ant\ant\bin>groovy t.groovy
1
Output
Buildfile: build.xml does not exist!

Error
Build failed
D:\java\tools\ant\ant\bin>
======================

qed, return codes get passed, if the called script delivers them
properly to caller.

Best regards,
Victor

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to