Changeset 12102


Ignore:
Timestamp:
May 20, 2009, 11:26:22 PM (10 years ago)
Author:
mikel
Message:

Added some checking and error-handling around swank startup that prevents the most common errors. Also added a special variable, gui::*ccl-swank-active-p*, that indicates whether the swank server has successfully started up.

Location:
trunk/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/start.lisp

    r12093 r12102  
    8888    (require :swank))
    8989
     90(defun gui-swank-port ()
     91  ;; TODO: get the port from a user preference and use
     92  ;;       the global as a fallback
     93  *default-gui-swank-port*)
     94
    9095(defun try-starting-swank ()
    91   (swank:create-server :port *ccl-gui-swank-port* :dont-close t))
     96  (unless *ccl-swank-active-p*
     97   (handler-case (swank:create-server :port (gui-swank-port) :dont-close t)
     98     (serious-condition (c)
     99       (setf *ccl-swank-active-p* nil)
     100       (format t "~%Error starting swank server: ~A~%" c)
     101       (force-output))
     102     (:no-error (result) (setf *ccl-swank-active-p* t)))))
    92103
    93104(defmethod toplevel-function ((a cocoa-application) init-file)
  • trunk/source/cocoa-ide/swank.lisp

    r12093 r12102  
    11(in-package :GUI)
    22
    3 (defparameter *ccl-gui-swank-port* 4564)
     3(defparameter *default-gui-swank-port* 4564)
     4(defparameter *ccl-swank-active-p* nil)
    45
    56(load #P"ccl:cocoa-ide;slime;swank-loader.lisp")
  • trunk/source/lib/misc.lisp

    r12100 r12102  
    865865(defun local-svn-revision ()
    866866  (let* ((s (make-string-output-stream))
    867           (root (native-translated-namestring "ccl:")))
    868      (when *use-cygwin-svn*
    869        (setq root (cygpath root)))
    870      (multiple-value-bind (status exit-code)
    871            (external-process-status
    872             (run-program "svnversion"  (list  (native-translated-namestring "ccl:") (or (svn-url) "")) :output s :error :output))
    873          (when (and (eq :exited status) (zerop exit-code))
    874            (with-input-from-string (output (get-output-stream-string s))
    875              (let* ((line (read-line output nil nil)))
    876                (when (and line (parse-integer line :junk-allowed t) )
    877                  (return-from local-svn-revision line))))))
    878      nil))
     867         (root (native-translated-namestring "ccl:")))
     868    (when *use-cygwin-svn*
     869      (setq root (cygpath root)))
     870    (multiple-value-bind (status exit-code)
     871        (external-process-status
     872         (run-program "svnversion"  (list  (native-translated-namestring "ccl:") (or (svn-url) "")) :output s :error :output))
     873      (when (and (eq :exited status) (zerop exit-code))
     874        (with-input-from-string (output (get-output-stream-string s))
     875          (let* ((line (read-line output nil nil)))
     876            (when (and line (parse-integer line :junk-allowed t) )
     877              (return-from local-svn-revision line))))))
     878    nil))
    879879
    880880
Note: See TracChangeset for help on using the changeset viewer.