groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Merlin Beedell <MBeed...@cryoserver.com>
Subject GroovyConsole System.exit() suggestion
Date Fri, 04 Sep 2015 16:36:03 GMT
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

Mime
View raw message