[slime-cvs] CVS slime
CVS User heller
heller at common-lisp.net
Fri Mar 27 20:49:49 UTC 2009
Update of /project/slime/cvsroot/slime
In directory cl-net:/tmp/cvs-serv26674
Modified Files:
ChangeLog swank.lisp
Log Message:
* swank.lisp (encode-message): Handle errors during write, e.g.
closed sockets.
--- /project/slime/cvsroot/slime/ChangeLog 2009/03/27 20:49:41 1.1722
+++ /project/slime/cvsroot/slime/ChangeLog 2009/03/27 20:49:49 1.1723
@@ -1,5 +1,10 @@
2009-03-27 Helmut Eller <heller at common-lisp.net>
+ * swank.lisp (encode-message): Handle errors during write, e.g.
+ closed sockets.
+
+2009-03-27 Helmut Eller <heller at common-lisp.net>
+
* slime.el (slime-setup-contribs): Moved over from
slime-autoloads.el
--- /project/slime/cvsroot/slime/swank.lisp 2009/03/09 11:06:24 1.639
+++ /project/slime/cvsroot/slime/swank.lisp 2009/03/27 20:49:49 1.640
@@ -1330,16 +1330,18 @@
(defun simple-serve-requests (connection)
(unwind-protect
- (call-with-user-break-handler
- (lambda ()
- (invoke-or-queue-interrupt #'dispatch-interrupt-event))
- (lambda ()
- (with-simple-restart (close-connection "Close SLIME connection")
- ;;(handle-requests connection)
- (let* ((stdin (real-input-stream *standard-input*))
- (*standard-input* (make-repl-input-stream connection
- stdin)))
- (simple-repl)))))
+ (with-connection (connection)
+ (call-with-user-break-handler
+ (lambda ()
+ (invoke-or-queue-interrupt #'dispatch-interrupt-event))
+ (lambda ()
+ (with-simple-restart (close-connection "Close SLIME connection")
+ ;;(handle-requests connection)
+ (let* ((stdin (real-input-stream *standard-input*))
+ (*standard-input* (make-repl-input-stream connection
+ stdin)))
+ (with-swank-error-handler (connection)
+ (simple-repl)))))))
(close-connection connection nil (safe-backtrace))))
(defun simple-repl ()
@@ -1360,18 +1362,24 @@
(defun make-repl-input-stream (connection stdin)
(make-input-stream
(lambda ()
+ (log-event "pull-input: ~a ~a ~a~%"
+ (connection.socket-io connection)
+ (if (open-stream-p (connection.socket-io connection))
+ :socket-open :socket-closed)
+ (if (open-stream-p stdin)
+ :stdin-open :stdin-closed))
(loop
- (with-connection (connection)
- (let* ((socket (connection.socket-io connection))
- (inputs (list socket stdin))
- (ready (wait-for-input inputs)))
- (cond ((eq ready :interrupt)
- (check-slime-interrupts))
- ((member socket ready)
- (handle-requests connection t))
- ((member stdin ready)
- (return (read-non-blocking stdin)))
- (t (assert (null ready))))))))))
+
+ (let* ((socket (connection.socket-io connection))
+ (inputs (list socket stdin))
+ (ready (wait-for-input inputs)))
+ (cond ((eq ready :interrupt)
+ (check-slime-interrupts))
+ ((member socket ready)
+ (handle-requests connection t))
+ ((member stdin ready)
+ (return (read-non-blocking stdin)))
+ (t (assert (null ready)))))))))
(defun read-non-blocking (stream)
(with-output-to-string (str)
@@ -1775,16 +1783,15 @@
(send-to-emacs object))
(defun encode-message (message stream)
- (let* ((string (prin1-to-string-for-emacs message))
- (length (length string)))
- (assert (<= length #xffffff))
- (log-event "WRITE: ~A~%" string)
- (let ((*print-pretty* nil))
- (format stream "~6,'0x" length))
- (write-string string stream)
- ;;(terpri stream)
- (finish-output stream)))
-
+ (handler-bind ((error (lambda (c) (error (make-swank-error c)))))
+ (let* ((string (prin1-to-string-for-emacs message))
+ (length (length string)))
+ (log-event "WRITE: ~A~%" string)
+ (let ((*print-pretty* nil))
+ (format stream "~6,'0x" length))
+ (write-string string stream)
+ (finish-output stream))))
+
(defun prin1-to-string-for-emacs (object)
(with-standard-io-syntax
(let ((*print-case* :downcase)
More information about the slime-cvs
mailing list