groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keegan Witt <keeganw...@gmail.com>
Subject Re: GroovyConsole System.exit() suggestion
Date Fri, 04 Sep 2015 17:34:00 GMT
I'd opened GROOVY-3963 <https://issues.apache.org/jira/browse/GROOVY-3963> a
while back to start to separating Console processes (though it doesn't
propose separating it as much as you did).  I'd love to have that feature,
but haven't had time to think about how we'd get around some of the
complications.  Once they are separated though, we could offer the option
to disable exits with a SecurityManager as Schalk's link discusses.

-Keegan

On Fri, Sep 4, 2015 at 1:07 PM, Schalk Cronjé <ysb33r@gmail.com> wrote:

>
> 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
>
>

Mime
View raw message