# HG changeset patch # User Steve Losh # Date 1545259443 18000 # Node ID c2c6f95f56358d9091292e3c68238695e2a3c113 # Parent db75783ac25881c196695a20dc41e2b419a7e19c More diff -r db75783ac258 -r c2c6f95f5635 lisp/clhs.lisp --- a/lisp/clhs.lisp Wed Dec 19 14:07:58 2018 -0500 +++ b/lisp/clhs.lisp Wed Dec 19 17:44:03 2018 -0500 @@ -117,23 +117,23 @@ :reduce #'adopt:newest)) (defun toplevel () - (multiple-value-bind (arguments options) (adopt:parse-options *ui*) - (when (gethash 'help options) - (adopt:print-usage *ui*) - (adopt:exit 0)) - (let ((*open* (gethash 'open options)) - (*url* (gethash 'url options)) - (target (first arguments))) - (if (gethash 'rebuild-cache options) - (rebuild-cache) - (progn - (when (/= (length arguments) 1) - (cerror "Type a symbol" - "Exactly one symbol to look up must be provided (got ~D: ~S)" - (length arguments) - arguments) - (setf arguments (list (read-line)))) - (unless (run target) - (format *error-output* "Symbol not found: ~A~%" target) - (adopt:exit 1))))))) - + (handler-case + (multiple-value-bind (arguments options) (adopt:parse-options *ui*) + (when (gethash 'help options) + (adopt:print-usage-and-exit *ui*)) + (let ((*open* (gethash 'open options)) + (*url* (gethash 'url options)) + (target (first arguments))) + (if (gethash 'rebuild-cache options) + (rebuild-cache) + (progn + (when (/= (length arguments) 1) + (cerror "Type a symbol" + "Exactly one symbol to look up must be provided (got ~D: ~S)" + (length arguments) + arguments) + (setf arguments (list (read-line)))) + (unless (run target) + (print-error-and-exit + (format nil "Symbol not found: ~A~%" target))))))) + (error (c) (adopt:print-error-and-exit c))))