Handle shutdown more gracefully.

master
Thomas Hintz 11 years ago
parent 7a26e3dd71
commit d559c6e063

@ -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))

Loading…
Cancel
Save