I'm adding some signal handlers to an application I'm writing, so it acts like a well-behaved Unix daemon. It would be nice to do something like:
(defun handle-sighup (&rest ignore) (declare (ignore ignore)) #+debug (cerror "Restart server" "Signal request to restart") (shutdown) (read-configuration) (startup))
The problem is that if I call break from a signal handler, the normal SBCL toplevel enters the debugger. With the following patch, I can set *debugger-hook* to swank:swank-debugger-hook at the toplevel:
--- swank.lisp.~1.166.~ Thu Apr 8 16:41:05 2004 +++ swank.lisp Wed Apr 14 18:37:54 2004 @@ -14,6 +14,7 @@ #:create-swank-server #:ed-in-emacs #:print-indentation-lossage + #:swank-debugger-hook ;; configurables #:*sldb-pprint-frames* #:*communication-style* @@ -882,7 +883,8 @@ *package*)) (*sldb-level* (1+ *sldb-level*)) (*swank-state-stack* (cons :swank-debugger-hook *swank-state-stack*)) - (*print-readably* nil)) + (*print-readably* nil) + (*emacs-connection* (or *emacs-connection* (default-connection)))) (force-user-output) (call-with-debugging-environment (lambda () (sldb-loop *sldb-level*)))))