How to get a return value from an exec in ant script?

Use the resultproperty and failonerror attributes of the exec task, e.g.

Use the resultproperty and failonerror attributes of the exec task, e.g. : Quoting from the exec task docs Errors and return codes: By default the return code of an exec is ignored; when you set failonerror="true" then any return code signaling failure (OS specific) causes the build to fail. Alternatively, you can set resultproperty to the name of a property and have it assigned to the result code (barring immutability, of course). If the attempt to start the program fails with an OS dependent error code, then halts the build unless failifexecutionfails is set to false.

You can use that to run a program if it exists, but otherwise do nothing. What do those error codes mean? Well, they are OS dependent.

On Windows boxes you have to look at the documentation; error code 2 means 'no such program', which usually means it is not on the path. Any time you see such an error from any Ant task, it is usually not an Ant bug, but some configuration problem on your machine.

Thanks. This works! I tried outputproperty and errorproperty, but didn't see resultproperty.

– Hyden Dec 3 '10 at 9:49.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions