mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
Add jupyter-delete-all-kernels
Add this to `kill-emacs-hook` to ensure that connection files are cleaned up in a more reliable fashion. The connection files are cleaned up when the kernel process is garbage collected, but this won't happen when killing Emacs. * jupyter-kernel-manager.el (jupyter-delete-all-kernels): Do it. Add to `kill-emacs-hook`.
This commit is contained in:
parent
df36a486aa
commit
9097464cc8
1 changed files with 14 additions and 0 deletions
|
@ -96,6 +96,20 @@ default kernel is a python kernel."
|
|||
"Return a list of all live kernel managers."
|
||||
(jupyter-all-objects 'jupyter--managers))
|
||||
|
||||
(defun jupyter-delete-all-kernels ()
|
||||
;; Ensure any resources the process has are cleaned up, e.g. connection
|
||||
;; files
|
||||
(dolist (manager (jupyter-kernel-managers))
|
||||
(with-slots (kernel) manager
|
||||
(set-process-plist kernel nil)
|
||||
(when (process-live-p kernel)
|
||||
(delete-process kernel))))
|
||||
;; TODO: If we are doing this, should we just go back to having a slot for
|
||||
;; the connection file?
|
||||
(garbage-collect))
|
||||
|
||||
(add-hook 'kill-emacs-hook 'jupyter-delete-all-kernels)
|
||||
|
||||
(cl-defgeneric jupyter-make-client ((manager jupyter-kernel-manager) class &rest slots)
|
||||
"Make a new client from CLASS connected to MANAGER's kernel.
|
||||
SLOTS are the slots used to initialize the client with.")
|
||||
|
|
Loading…
Add table
Reference in a new issue