-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kill server with client #1184
Kill server with client #1184
Conversation
@@ -724,6 +724,15 @@ If NO-ERROR is non-nil, show messages instead of throwing an error." | |||
;; `nrepl-start-client-process' is called from `nrepl-server-filter'. It | |||
;; starts the client process described by `nrepl-client-filter' and | |||
;; `nrepl-client-sentinel'. | |||
(defun nrepl--maybe-kill-server-buffer () | |||
"Kill the `nrepl-server-buffer' and its process, subject to use confirmation." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use => user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Also moved the function above that block of comments, since the block is about the following function.
This seems like it's duplicating the functionality of |
@expez This is for when the connection hangs. In those cases |
Btw, reworking |
@expez Some people will always try to kill just the current REPL, so this functionality makes sense for me. And as I said I still ask myself why this ended up in its current state - most likely because I generally work with only connection and this hasn't been much of an issue for me. |
Not to mention, killing the buffer is a traditionally a viable way of cancelling/stopping things in Emacs, even when a subprocess is involved. So it would be nice for Cider to try to handle that somewhat gracefully too.
Or change the default behaviour to “quit current” and make the “quit all” behaviour available with a prefix key. |
But anyway, killing the repl is something I do when it hangs (I suppose it happens more often than it should with me because of all the hacking around the debug middleware :), usually I just |
Yep, that's a good suggest. Btw, something came to mind - we're killing the connection using a sentinel if the process that created the nrepl server died. Maybe we can use a sentinel for the REPL process as well for consistency. Not sure if we gain anything by this. |
@bbatsov I had a look the code in ((string-match-p "^killed" event)
nil)
((string-match-p "^hangup" event)
(when connection-buffer
(nrepl-close connection-buffer))) |
Beats me. I see this was labeled a bug fix in the past https://github.com/clojure-emacs/cider/blob/master/CHANGELOG.md#bugs-fixed-14 Maybe the idea was to be able to kill the server buffer and recycle the REPL buffer or something like this. Guess we can find the PR related to this. |
Seems to me this was a mistake - #160 |
Btw, in the mean time I've changed the behaviour of |
I've added something to the client sentinel so that it kills the server process too when the client dies. The server buffer is only offered to be killed if the client buffer is killed. Does it look reasonable? |
Looks legit. Just add a changelog entry for this. |
Logged. |
👍 |
Whenever the nrepl hangs for one reason or another, you have to kill two different buffers each with its own process. This hook makes it easier to kill the server after killing the client.