quit, exit and stop-app

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

quit, exit and stop-app

Jeff Brown-4
For Grails 2.2 from within the interactive console we have 3 related commands:

- exit
- quit
- stop-app

The quit command quits the console.  The stop-app command stops an application that is running in forked mode.  The exit command stops an app that was run in non-forked mode if one is running, otherwise it behaves like quit.  

I have recently made changes so the stop-app will stop the application if it is running in forked mode or non-forked mode.  The exit command does not work forked mode.  The exit command will quit the console if an application is running in forked mode.  Before fixing that I would like to open up for discussion how we want to handle this.

I think it suspect that exit behaves like stop-app if an app is running and behaves like quit if there is no application running. The overloading here seems a little hinky to me. There are several ways would make all of this work.  I propose the following.

The exit and quit commands are aliased to do the same thing and that is exit the console.  Neither of them does any stop-app stuff.  If an app is running in non-forked mode, the app will die because the VM dies.  If an app is running in forked-mode, the app will continue running.  The stop-app command stops a running app (forked or otherwise).

One issue that some folks might have with that approach is that it may leave an app running that they didn't intend to leave running if they exit after running a forked app that they forgot was running.  We could detect this situation and log a message and/or we can prompt with an Are You Sure? question.  If the user has left the console and left a forked app running, they can kill it with "grails stop-app" or by starting the console back up and running stop-app (or just pointing their browser at port+1, but that isn't the best thing to promote).

I think my main issue is with the overloading of "exit".

What say ye?

Thanks for your time.



JSB

--
Jeff Brown
[hidden email]
SpringSource - A Division Of VMware
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: quit, exit and stop-app

John Fletcher-3
Jeff,
 
As you haven't asked a direct question you might not get a clear response. But here is my opinion: never ask someone whether they really want to do something unless the consequences of a mistake are dramatic and hard to reverse. Don't ask whether the user really wants to quit the console when there's a forked app running. It would be better to put a little info printout when you start the forked app like "to stop run stop-app, exiting the console will not stop the app" and/or a suggestion to look in this direction or run "stop-app" when your grails app won't start because the port is in use.
In particular, forked mode is not the default, therefore people who choose to enable it will presumably have some idea of what they are doing and the possible consequences.
 
Regarding quit and exit, what you have proposed seems OK. But wouldn't it be more useful to have one of them close the console (killing any non-forked VM) and have the other effectively run stop-app and then close the console (i.e. killing forked and non-forked apps)? Then the developer has more handy commands at his disposal and the forked-app developer can "exit grails entirely" with one four-letter command.
 
John
2012/11/19 Jeff Brown <[hidden email]>
For Grails 2.2 from within the interactive console we have 3 related commands:

- exit
- quit
- stop-app

The quit command quits the console.  The stop-app command stops an application that is running in forked mode.  The exit command stops an app that was run in non-forked mode if one is running, otherwise it behaves like quit.

I have recently made changes so the stop-app will stop the application if it is running in forked mode or non-forked mode.  The exit command does not work forked mode.  The exit command will quit the console if an application is running in forked mode.  Before fixing that I would like to open up for discussion how we want to handle this.

I think it suspect that exit behaves like stop-app if an app is running and behaves like quit if there is no application running. The overloading here seems a little hinky to me. There are several ways would make all of this work.  I propose the following.

The exit and quit commands are aliased to do the same thing and that is exit the console.  Neither of them does any stop-app stuff.  If an app is running in non-forked mode, the app will die because the VM dies.  If an app is running in forked-mode, the app will continue running.  The stop-app command stops a running app (forked or otherwise).

One issue that some folks might have with that approach is that it may leave an app running that they didn't intend to leave running if they exit after running a forked app that they forgot was running.  We could detect this situation and log a message and/or we can prompt with an Are You Sure? question.  If the user has left the console and left a forked app running, they can kill it with "grails stop-app" or by starting the console back up and running stop-app (or just pointing their browser at port+1, but that isn't the best thing to promote).

I think my main issue is with the overloading of "exit".

What say ye?

Thanks for your time.



JSB

--
Jeff Brown
[hidden email]
SpringSource - A Division Of VMware
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: quit, exit and stop-app

pledbrook
> In particular, forked mode is not the default, therefore people who choose
> to enable it will presumably have some idea of what they are doing and the
> possible consequences.

Yes, but it's easy to forget you have it enabled and then you have to
track down which app is running on the conflicted port. To be honest,
I would prefer quit to automatically kill the forked VM, i.e. run
stop-app.

> Regarding quit and exit, what you have proposed seems OK. But wouldn't it be
> more useful to have one of them close the console (killing any non-forked
> VM) and have the other effectively run stop-app and then close the console
> (i.e. killing forked and non-forked apps)? Then the developer has more handy
> commands at his disposal and the forked-app developer can "exit grails
> entirely" with one four-letter command.

'exit' and 'quit' are synonyms, so making them do different things
just confuses people. Certainly confuses me. I think 'exit' and 'quit'
should just be synonyms. I do agree that 'exit' should *not* be used
as a stop-app if run-app is operational.

Peter

--
Peter Ledbrook
Developer Advocate
VMware

t: @pledbrook

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: quit, exit and stop-app

John Fletcher-3
2012/11/19 Peter Ledbrook <[hidden email]>
Yes, but it's easy to forget you have it enabled and then you have to
track down which app is running on the conflicted port. To be honest,
I would prefer quit to automatically kill the forked VM, i.e. run
stop-app.
 
I should probably point out that I'm not using the 2.2 pre-releases, so I'm just speaking theoretically, not from experience. 
 
John

Reply | Threaded
Open this post in threaded view
|

Re: quit, exit and stop-app

Jeff Brown-4
In reply to this post by John Fletcher-3

On Nov 19, 2012, at 3:19 AM, John Fletcher <[hidden email]> wrote:

> Jeff,
>  
> As you haven't asked a direct question you might not get a clear response.

It seems that I may have more faith in the dev team than you do.


> But here is my opinion: never ask someone whether they really want to do something unless the consequences of a mistake are dramatic and hard to reverse. Don't ask whether the user really wants to quit the console when there's a forked app running. It would be better to put a little info printout when you start the forked app like "to stop run stop-app, exiting the console will not stop the app" and/or a suggestion to look in this direction or run "stop-app" when your grails app won't start because the port is in use.
> In particular, forked mode is not the default, therefore people who choose to enable it will presumably have some idea of what they are doing and the possible consequences.
>  
> Regarding quit and exit, what you have proposed seems OK. But wouldn't it be more useful to have one of them close the console (killing any non-forked VM) and have the other effectively run stop-app and then close the console (i.e. killing forked and non-forked apps)? Then the developer has more handy commands at his disposal and the forked-app developer can "exit grails entirely" with one four-letter command.
>  
> John

Thanks for the clear response. That is helpful and I appreciate the input.



JSB
--
Jeff Brown
[hidden email]
SpringSource - A Division Of VMware
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: quit, exit and stop-app

Graeme Rocher
Administrator
In reply to this post by Jeff Brown-4
+1 for the suggested changes in behaviour. The less surprises for the user the better


On Mon, Nov 19, 2012 at 12:18 AM, Jeff Brown <[hidden email]> wrote:
For Grails 2.2 from within the interactive console we have 3 related commands:

- exit
- quit
- stop-app

The quit command quits the console.  The stop-app command stops an application that is running in forked mode.  The exit command stops an app that was run in non-forked mode if one is running, otherwise it behaves like quit.

I have recently made changes so the stop-app will stop the application if it is running in forked mode or non-forked mode.  The exit command does not work forked mode.  The exit command will quit the console if an application is running in forked mode.  Before fixing that I would like to open up for discussion how we want to handle this.

I think it suspect that exit behaves like stop-app if an app is running and behaves like quit if there is no application running. The overloading here seems a little hinky to me. There are several ways would make all of this work.  I propose the following.

The exit and quit commands are aliased to do the same thing and that is exit the console.  Neither of them does any stop-app stuff.  If an app is running in non-forked mode, the app will die because the VM dies.  If an app is running in forked-mode, the app will continue running.  The stop-app command stops a running app (forked or otherwise).

One issue that some folks might have with that approach is that it may leave an app running that they didn't intend to leave running if they exit after running a forked app that they forgot was running.  We could detect this situation and log a message and/or we can prompt with an Are You Sure? question.  If the user has left the console and left a forked app running, they can kill it with "grails stop-app" or by starting the console back up and running stop-app (or just pointing their browser at port+1, but that isn't the best thing to promote).

I think my main issue is with the overloading of "exit".

What say ye?

Thanks for your time.



JSB

--
Jeff Brown
[hidden email]
SpringSource - A Division Of VMware
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com
Reply | Threaded
Open this post in threaded view
|

Re: quit, exit and stop-app

Nathan Wells
I agree that quit and exit should be the same. If either detects a forked app, I think logging to the console would be appropriate. Something like the following:

grails > exit
Exiting...
Detected a forked grails instance. Run 'grails stop-app' to kill it.

nwwells@foo $


Nathan Wells


On Mon, Nov 19, 2012 at 5:58 AM, Graeme Rocher <[hidden email]> wrote:
+1 for the suggested changes in behaviour. The less surprises for the user the better


On Mon, Nov 19, 2012 at 12:18 AM, Jeff Brown <[hidden email]> wrote:
For Grails 2.2 from within the interactive console we have 3 related commands:

- exit
- quit
- stop-app

The quit command quits the console.  The stop-app command stops an application that is running in forked mode.  The exit command stops an app that was run in non-forked mode if one is running, otherwise it behaves like quit.

I have recently made changes so the stop-app will stop the application if it is running in forked mode or non-forked mode.  The exit command does not work forked mode.  The exit command will quit the console if an application is running in forked mode.  Before fixing that I would like to open up for discussion how we want to handle this.

I think it suspect that exit behaves like stop-app if an app is running and behaves like quit if there is no application running. The overloading here seems a little hinky to me. There are several ways would make all of this work.  I propose the following.

The exit and quit commands are aliased to do the same thing and that is exit the console.  Neither of them does any stop-app stuff.  If an app is running in non-forked mode, the app will die because the VM dies.  If an app is running in forked-mode, the app will continue running.  The stop-app command stops a running app (forked or otherwise).

One issue that some folks might have with that approach is that it may leave an app running that they didn't intend to leave running if they exit after running a forked app that they forgot was running.  We could detect this situation and log a message and/or we can prompt with an Are You Sure? question.  If the user has left the console and left a forked app running, they can kill it with "grails stop-app" or by starting the console back up and running stop-app (or just pointing their browser at port+1, but that isn't the best thing to promote).

I think my main issue is with the overloading of "exit".

What say ye?

Thanks for your time.



JSB

--
Jeff Brown
[hidden email]
SpringSource - A Division Of VMware
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

Reply | Threaded
Open this post in threaded view
|

Re: quit, exit and stop-app

Jeff Brown-4
In reply to this post by Jeff Brown-4

On Nov 18, 2012, at 5:18 PM, Jeff Brown <[hidden email]> wrote:

> For Grails 2.2 from within the interactive console we have 3 related commands:
>
> - exit
> - quit
> - stop-app
>
> The quit command quits the console.  The stop-app command stops an application that is running in forked mode.  The exit command stops an app that was run in non-forked mode if one is running, otherwise it behaves like quit.  
>
> I have recently made changes so the stop-app will stop the application if it is running in forked mode or non-forked mode.  The exit command does not work forked mode.  The exit command will quit the console if an application is running in forked mode.  Before fixing that I would like to open up for discussion how we want to handle this.
>
> I think it suspect that exit behaves like stop-app if an app is running and behaves like quit if there is no application running. The overloading here seems a little hinky to me. There are several ways would make all of this work.  I propose the following.
>
> The exit and quit commands are aliased to do the same thing and that is exit the console.  Neither of them does any stop-app stuff.  If an app is running in non-forked mode, the app will die because the VM dies.  If an app is running in forked-mode, the app will continue running.  The stop-app command stops a running app (forked or otherwise).
>
> One issue that some folks might have with that approach is that it may leave an app running that they didn't intend to leave running if they exit after running a forked app that they forgot was running.  We could detect this situation and log a message and/or we can prompt with an Are You Sure? question.  If the user has left the console and left a forked app running, they can kill it with "grails stop-app" or by starting the console back up and running stop-app (or just pointing their browser at port+1, but that isn't the best thing to promote).
>
> I think my main issue is with the overloading of "exit".
>
> What say ye?
>
> Thanks for your time.
>



This is where I am leaning based on comments in this thread and discussions outside of the thread.  I do think it is probably a good idea to allow a way to express something like "quit the console and kill the app if it is running".

This is what I think makes sense:

stop-app - stops the app
exit - exits the console
quit - stops the app and exits the console

Note that "exit" doesn't have any explicit app stopping associated with it.  If the app is running in forked mode, it is left running.  Some folks may have use for this.  If it is running in non-forked mode, the app will die because the VM dies on exit.




JSB
--
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: quit, exit and stop-app

pledbrook
> This is what I think makes sense:
>
> stop-app - stops the app
> exit - exits the console
> quit - stops the app and exits the console
>
> Note that "exit" doesn't have any explicit app stopping associated with it.  If the app is running in forked mode, it is left running.  Some folks may have use for this.  If it is running in non-forked mode, the app will die because the VM dies on exit.

Many applications and tools use either exit or quit to essentially do
the same thing. That means coming back to Grails would be confusing in
the above case because they do subtly different things without really
having that difference explicit in their names.

For all intents and purposes, exit and quit are synonyms and I think
they should be treated as such.

Now, if anyone wants to be able to select between the two behaviours,
perhaps a stopAndQuit command? If that's too long for the experienced
users, it could be aliased. Or perhaps quitNoStop if people prefer the
default to be stopping the application on quit/exit.

I understand the argument that regular Grails users will become
familiar with the differences and naturally use one or the other, but
what if you stop Grails development for a while and come back? What
about new users? I just see it as a source of confusion.

Anyway, we are at least agreed on the most important aspect that exit
should not do different things depending on the current state of the
system (whether an app is running or not).

Cheers,

Peter

--
Peter Ledbrook
Developer Advocate
VMware

t: @pledbrook

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: quit, exit and stop-app

Jeff Brown-4

On Nov 20, 2012, at 11:59 AM, Peter Ledbrook <[hidden email]> wrote:

>> This is what I think makes sense:
>>
>> stop-app - stops the app
>> exit - exits the console
>> quit - stops the app and exits the console
>>
>> Note that "exit" doesn't have any explicit app stopping associated with it.  If the app is running in forked mode, it is left running.  Some folks may have use for this.  If it is running in non-forked mode, the app will die because the VM dies on exit.
>
> Many applications and tools use either exit or quit to essentially do
> the same thing. That means coming back to Grails would be confusing in
> the above case because they do subtly different things without really
> having that difference explicit in their names.
>
> For all intents and purposes, exit and quit are synonyms and I think
> they should be treated as such.

I am fine to give in and do whatever makes the most sense to the most developers.  It doesn't bother me that 2 commands named exit and quit would do 2 different things.  The former is exiting the shell, the latter is quitting altogether, a more comprehensive action.  If that is going to be a headache for developers, then we shouldn't do it of course.



JSB
--
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email