posit-dev / ark

Ark, an R kernel
MIT License
159 stars 9 forks source link

For Jupyter, `q()` should probably be overridden to error and tell you how to actually shut down the right way #554

Open DavisVaughan opened 3 days ago

DavisVaughan commented 3 days ago
Screenshot 2024-09-30 at 4 46 58 PM

Otherwise R just dies and Jupyter throws warnings that R isn't responding to is_complete_request and friends


We could probably send the ask_exit payload from the kernel -> frontend, telling the frontend to request a shutdown? https://jupyter-client.readthedocs.io/en/stable/messaging.html#payloads-deprecated

Payloads are deprecated but there is currently no alternative, so I feel like we should just use it for now (its been deprecated for over 9 years...)

It looks like you send it as part of an execute_reply https://github.com/jupyter/jupyter_console/blob/fddbc42d2e0be85feace1fe783a05e2b569fceae/jupyter_console/ptshell.py#L743-L767

DavisVaughan commented 3 days ago

Oh ask_exit is also how ipython implements the exit and quit commands! i.e. when you type that directly at the console it:

So yea I doubt there is any way this would get removed and is probably safe to use