Run webserver after binary call and get user sigint
This commit is contained in:
parent
f36918b2c4
commit
0f4ac720d1
3 changed files with 22 additions and 2 deletions
|
@ -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)
|
||||
|
|
19
src/app.lisp
19
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))))
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
(:import-from #:hunchentoot
|
||||
#:easy-acceptor)
|
||||
(:export
|
||||
#:main
|
||||
#:*html-lang*
|
||||
#:survey
|
||||
#:survey-id
|
||||
|
|
Loading…
Add table
Reference in a new issue