Issue Details (XML | Word | Printable)

Key: GRAILS-2253
Type: Bug Bug
Status: Resolved Resolved
Resolution: Won't Fix
Priority: Major Major
Assignee: Graeme Rocher
Reporter: Mike Hugo
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Grails

TestApp.groovy calls exit(0) upon completion

Created: 22/Jan/08 07:27 PM   Updated: 24/Jan/08 06:43 AM
Component/s: None
Affects Version/s: 1.0-RC4
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Text File removeExitFromTestApp.patch (0.5 kB)


Patch Submitted: Yes


 Description  « Hide
The TestApp.groovy script calls exit(0) upon completion. I'm trying to write a script that would leverage the TestApp.groovy script but I need to do some processing AFTER the tests run. I was hopping I could write a simple GANT script that would do something like the following:

includeTargets << new File ( "${grailsHome}/scripts/TestApp.groovy" )
...
doSomePreProcessing()
testApp()
doSomePostProcessing()
...

But since the "processResults" target (which is called by testApp()) calls exit(0) when it's done running tests and creating reports, my "doSomePostProcessing" target never gets executed.

Is the exit(0) really needed? Don't gant scripts already provided return codes (http://gant.codehaus.org/Return+Codes)? If it's not explicitly needed, can it be removed? Patch attached.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Graeme Rocher added a comment - 24/Jan/08 05:30 AM
It needs to call exit to participate correctly in continuous integration servers. I don't want to remove it now just in case it breaks something, however when you include TestApp you can quite easily override exit simply by defining your own version that does nothing

Mike Hugo added a comment - 24/Jan/08 06:43 AM
Thanks! After a little playing around, I was able to do that. I just had to put the name of the target in quotes:

target('exit':"override exit") {
//TODO - ignore '0' exit code, process any other return code (e.g. -1)
}