Well - this would help if it was part of the Console app. I don't really want to pop this code in to each script just for testing purposes.
Furthermore, it would also be nice if the console could setup the args[] & stdin features. This would mean: Ø Ability to pass parameters to scripts (to emulate a command line) Ø Pipe output of an o/s statement to the current script. [dir c:/ | <this script>]. The console would need to launch the o/s command etc. ..and so the wish list grows!! Merlin Beedell From: Schalk Cronjé [mailto:ysb...@gmail.com] Sent: 04 September 2015 18:07 To: users@groovy.incubator.apache.org Subject: Re: GroovyConsole System.exit() suggestion Does this - http://jroller.com/ethdsy/entry/disabling_system_exit - help ? On 04/09/2015 17:36, Merlin Beedell wrote: I note that the useful GroovyConsole will exit if the script being run hits a System.exit(). This is understandable when the script runs in that same thread as the Console. But it would be really useful to be able to run scripts in a separate thread to protect against exit() [and to display the exit value] and also for scripts with infinite loops that need to be killed! And, maybe, it would also allow these scripts to obtain the 'console' object for keyboard input? Console cons = System.console() Boolean isWorking () { if (!cons) { println "Cannot open a console for input" //always the case under GroovyConsole } return (cons != null) } Merlin Beedell -- Schalk W. Cronjé Twitter / Ello / Toeter : @ysb33r