Skip to content

Commit e6e1054

Browse files
committed
Quit immediately when SIGINT is received.
1 parent 44eeeff commit e6e1054

File tree

1 file changed

+52
-50
lines changed

1 file changed

+52
-50
lines changed

roswell/qlot.ros

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -26,56 +26,58 @@ exec ros +Q -- $0 "$@"
2626

2727
(defun main (&optional $1 &rest argv)
2828
(declare (ignorable argv))
29-
(cond ((equal "install" $1)
30-
(when (and (first argv)
31-
(not (probe-file (first argv))))
32-
(print-error "'~A' does not found." (first argv)))
33-
(ros:quicklisp)
34-
(uiop:symbol-call :ql :quickload :qlot :silent t)
35-
(if argv
36-
(uiop:symbol-call :qlot :install (probe-file (first argv)))
37-
(uiop:symbol-call :qlot :install)))
38-
((equal "update" $1)
39-
(when (and (first argv)
40-
(not (probe-file (first argv))))
41-
(print-error "'~A' does not found." (first argv)))
42-
(ros:quicklisp)
43-
(uiop:symbol-call :ql :quickload :qlot :silent t)
44-
(if argv
45-
(uiop:symbol-call :qlot :update (probe-file (first argv)))
46-
(uiop:symbol-call :qlot :update)))
47-
((equal "bundle" $1)
48-
(ros:quicklisp)
49-
(uiop:symbol-call :ql :quickload :qlot :silent t)
50-
(uiop:symbol-call :qlot :bundle))
51-
((equal "exec" $1)
52-
;; Set QUICKLISP_HOME ./quicklisp/
53-
(unless (ros:getenv "QUICKLISP_HOME")
54-
(setenv "QUICKLISP_HOME" "quicklisp/"))
55-
(let ((path (or (probe-file (ros:getenv "QUICKLISP_HOME"))
56-
(merge-pathnames (ros:getenv "QUICKLISP_HOME")
57-
(make-pathname :defaults *load-pathname* :name nil :type nil)))))
58-
(unless (probe-file path)
59-
(print-error "'~A' does not exist."
60-
(ros:getenv "QUICKLISP_HOME")))
61-
(unless (probe-file (merge-pathnames "setup.lisp" path))
62-
(print-error "Invalid Quicklisp directory: '~A'"
63-
(ros:getenv "QUICKLISP_HOME"))))
29+
(handler-case
30+
(cond ((equal "install" $1)
31+
(when (and (first argv)
32+
(not (probe-file (first argv))))
33+
(print-error "'~A' does not found." (first argv)))
34+
(ros:quicklisp)
35+
(uiop:symbol-call :ql :quickload :qlot :silent t)
36+
(if argv
37+
(uiop:symbol-call :qlot :install (probe-file (first argv)))
38+
(uiop:symbol-call :qlot :install)))
39+
((equal "update" $1)
40+
(when (and (first argv)
41+
(not (probe-file (first argv))))
42+
(print-error "'~A' does not found." (first argv)))
43+
(ros:quicklisp)
44+
(uiop:symbol-call :ql :quickload :qlot :silent t)
45+
(if argv
46+
(uiop:symbol-call :qlot :update (probe-file (first argv)))
47+
(uiop:symbol-call :qlot :update)))
48+
((equal "bundle" $1)
49+
(ros:quicklisp)
50+
(uiop:symbol-call :ql :quickload :qlot :silent t)
51+
(uiop:symbol-call :qlot :bundle))
52+
((equal "exec" $1)
53+
;; Set QUICKLISP_HOME ./quicklisp/
54+
(unless (ros:getenv "QUICKLISP_HOME")
55+
(setenv "QUICKLISP_HOME" "quicklisp/"))
56+
(let ((path (or (probe-file (ros:getenv "QUICKLISP_HOME"))
57+
(merge-pathnames (ros:getenv "QUICKLISP_HOME")
58+
(make-pathname :defaults *load-pathname* :name nil :type nil)))))
59+
(unless (probe-file path)
60+
(print-error "'~A' does not exist."
61+
(ros:getenv "QUICKLISP_HOME")))
62+
(unless (probe-file (merge-pathnames "setup.lisp" path))
63+
(print-error "Invalid Quicklisp directory: '~A'"
64+
(ros:getenv "QUICKLISP_HOME"))))
6465

65-
;; Overwrite CL_SOURCE_REGISTRY to the current directory
66-
(setenv "CL_SOURCE_REGISTRY" (namestring *default-pathname-defaults*))
66+
;; Overwrite CL_SOURCE_REGISTRY to the current directory
67+
(setenv "CL_SOURCE_REGISTRY" (namestring *default-pathname-defaults*))
6768

68-
;; Add ~/.roswell/bin to $PATH
69-
(setenv "PATH"
70-
(format nil "~A:~A"
71-
(merge-pathnames "bin/" (roswell.util:homedir))
72-
(ros:getenv "PATH")))
69+
;; Add ~/.roswell/bin to $PATH
70+
(setenv "PATH"
71+
(format nil "~A:~A"
72+
(merge-pathnames "bin/" (roswell.util:homedir))
73+
(ros:getenv "PATH")))
7374

74-
(let ((command (which (first argv))))
75-
(unless command
76-
(print-error "Command not found: ~A" (first argv)))
77-
(ros:exec (cons command (rest argv)))))
78-
(t (format *error-output*
79-
"~&Usage: ~A [install | update | bundle | exec shell-args..]~%"
80-
(file-namestring *load-pathname*))
81-
(ros:quit 1))))
75+
(let ((command (which (first argv))))
76+
(unless command
77+
(print-error "Command not found: ~A" (first argv)))
78+
(ros:exec (cons command (rest argv)))))
79+
(t (format *error-output*
80+
"~&Usage: ~A [install | update | bundle | exec shell-args..]~%"
81+
(file-namestring *load-pathname*))
82+
(ros:quit 1)))
83+
#+sbcl (sb-sys:interactive-interrupt () (uiop:quit -1 nil))))

0 commit comments

Comments
 (0)