Handle shutdown more gracefully.
This commit is contained in:
16
cl-init.lisp
16
cl-init.lisp
@@ -18,15 +18,19 @@
|
|||||||
(apply *start-thunk* nil)
|
(apply *start-thunk* nil)
|
||||||
(format t "external process running~%")
|
(format t "external process running~%")
|
||||||
|
|
||||||
; wait for stop signal
|
(ccl:with-open-socket (socket :connect :passive
|
||||||
(let* ((socket (ccl:make-socket :local-port *shutdown-port* :connect :passive))
|
:format :text
|
||||||
(stream (ccl:accept-connection socket))) ; wait for anything
|
:local-port *shutdown-port*
|
||||||
(close stream)
|
:reuse-address t)
|
||||||
(close socket))
|
(with-open-stream (stream (ccl:accept-connection socket))
|
||||||
|
|
||||||
(format t "stopping external process~%")
|
(format t "stopping external process~%")
|
||||||
(apply *stop-thunk* nil)
|
(apply *stop-thunk* nil)
|
||||||
(format t "external process stopped~%stopping swank~%")
|
(format t "external process stopped~%stopping swank~%")
|
||||||
(swank:stop-server *swank-port*)
|
(swank:stop-server *swank-port*)
|
||||||
(format t "swank stopped~%")
|
(format t "swank stopped~%")
|
||||||
|
(princ "server shutdown complete" stream)))
|
||||||
|
|
||||||
(ccl:quit))
|
(ccl:quit))
|
||||||
|
|
||||||
|
(defparameter socket (ccl:make-socket :local-port 6200 :connect :passive))
|
||||||
|
(defparameter stream (ccl:accept-connection socket))
|
||||||
|
|||||||
Reference in New Issue
Block a user