Last active
March 13, 2019 18:03
-
-
Save ympbyc/c2a791eded1f521ea87ba80b5308736a to your computer and use it in GitHub Desktop.
Every n seconds check if slime repl is actively updated. if not, interrupt and call a restart that gives up on current operation that's causing the hangup e.g. sockets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; every 60 seconds check if slime repl buffer has been updated | |
;; if not intterupt and call restart-1 | |
;; which should abort whatever is causing the hungup and continues | |
(defvar *slime-repl-last-output* "") | |
(defvar *slime-repl-watchdog-timer* nil) | |
(defun handle-sldb-restart () | |
(sldb-invoke-restart-1) ;; change here | |
(message "Invoked restart-1 upon detecting a hungup.")) | |
(setq *slime-repl-watchdog-timer* | |
(run-at-time "30 sec" 30 | |
(lambda () | |
(with-current-buffer (get-buffer "*slime-repl sbcl*") | |
(goto-char (max-char)) | |
(forward-line -1) ;;assuming the prompt has returned. | |
(let ((line (thing-at-point 'line t))) | |
(if (string= line *slime-repl-last-output*) | |
(progn (slime-interrupt) | |
(handle-sldb-restart)) | |
(setq *slime-repl-last-output* line))))))) | |
(cancel-timer *slime-repl-watchdog-timer*) | |
(list-timers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment