diff --git a/create-core.lisp b/create-core.lisp index eb71b67..b252376 100644 --- a/create-core.lisp +++ b/create-core.lisp @@ -8,7 +8,7 @@ (quicklisp-setup) (ql:quickload :dev.metalisp.survey) -(let ((app-name (uiop:os-cond (:windows "survey-buttler.exe") - (:linux "survey-buttler")))) +(let ((app-name (uiop:os-cond ((eq :os-windows (uiop:detect-os)) "survey-buttler.exe") + ((eq :os-unix (uiop:detect-os)) "survey-buttler")))) (sb-ext:save-lisp-and-die app-name :executable t :toplevel 'ml-survey:main)) (quit) diff --git a/src/app.lisp b/src/app.lisp index e6ef6dc..b4ec5f6 100644 --- a/src/app.lisp +++ b/src/app.lisp @@ -35,3 +35,22 @@ (defun start () (start-server *app*)) + +(defun main () + (start) + ;; let the webserver run. + ;; warning: hardcoded "hunchentoot". + ;; You can simply run (sleep most-positive-fixnum) + (handler-case (bt:join-thread (find-if (lambda (th) + (search "hunchentoot" (bt:thread-name th))) + (bt:all-threads))) + ;; Catch a user's C-c + (#+sbcl sb-sys:interactive-interrupt + #+ccl ccl:interrupt-signal-condition + #+clisp system::simple-interrupt-condition + #+ecl ext:interactive-interrupt + #+allegro excl:interrupt-signal + () (progn + (format *error-output* "Aborting.~&") + (uiop:quit))) + (error (c) (format t "Woops, an unknown error occured:~&~a~&" c)))) diff --git a/src/package.lisp b/src/package.lisp index f5d96b5..23c2d1b 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -3,6 +3,7 @@ (:import-from #:hunchentoot #:easy-acceptor) (:export + #:main #:*html-lang* #:survey #:survey-id