app/demo: experimental: keep app running until ctrl-c/kill signal
This commit is contained in:
parent
ec880c3695
commit
7a838af162
4 changed files with 20 additions and 11 deletions
|
@ -13,12 +13,23 @@
|
||||||
|
|
||||||
(in-package :scopes/app/demo)
|
(in-package :scopes/app/demo)
|
||||||
|
|
||||||
|
(defvar *quit-queue* (lparallel.queue:make-queue :fixed-capacity 1))
|
||||||
|
|
||||||
(defun main()
|
(defun main()
|
||||||
|
;(setf (trivial-signal:signal-handler :int) #'quit-handler)
|
||||||
|
;(setf (trivial-signal:signal-handler :term) #'quit-handler)
|
||||||
(let ((config-path (util:relative-path "config" "etc")))
|
(let ((config-path (util:relative-path "config" "etc")))
|
||||||
(format t "~%Hello World.~%config-path: ~s~%" config-path)
|
(format t "~%Hello World.~%config-path: ~s~%" config-path)
|
||||||
(load config-path))
|
(load config-path))
|
||||||
|
(unwind-protect
|
||||||
|
(progn
|
||||||
(core:setup-services)
|
(core:setup-services)
|
||||||
;(setf forge:*forge-env* (forge:forge-env))
|
;(setf forge:*forge-env* (forge:forge-env))
|
||||||
;(forge:setup-builtins)
|
;(forge:setup-builtins)
|
||||||
(forge:repl)
|
;(forge:repl)
|
||||||
(core:shutdown))
|
(lparallel.queue:pop-queue *quit-queue*))
|
||||||
|
(core:shutdown)))
|
||||||
|
|
||||||
|
(defun quit-handler (sig)
|
||||||
|
(format t "~%quit-handler: got signal ~s~%" sig)
|
||||||
|
(lparallel.queue:push-queue sig))
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
:version "0.0.1"
|
:version "0.0.1"
|
||||||
:homepage "https://www.cyberconcepts.org"
|
:homepage "https://www.cyberconcepts.org"
|
||||||
:description ""
|
:description ""
|
||||||
:depends-on (:scopes)
|
:depends-on (:scopes :lparallel :trivial-signal)
|
||||||
:components ((:file "main"))
|
:components ((:file "main"))
|
||||||
:build-operation "program-op"
|
:build-operation "program-op"
|
||||||
:build-pathname "bin/demo"
|
:build-pathname "bin/demo"
|
||||||
|
|
|
@ -47,8 +47,7 @@
|
||||||
(format nil
|
(format nil
|
||||||
"<a href=\"https://example.com\" title=\"Demo\" ~
|
"<a href=\"https://example.com\" title=\"Demo\" ~
|
||||||
class=\"demo-link plain\">Link to example.com</a>"))
|
class=\"demo-link plain\">Link to example.com</a>"))
|
||||||
(== (dom:render (dom:br nil))
|
(== (dom:render (dom:br)) (format nil "<br>")))
|
||||||
(format nil "<br>")))
|
|
||||||
|
|
||||||
(deftest test-jwt ()
|
(deftest test-jwt ()
|
||||||
(let ((secret (crypt:create-secret))
|
(let ((secret (crypt:create-secret))
|
||||||
|
|
|
@ -49,8 +49,7 @@
|
||||||
(defmethod put ((el element))
|
(defmethod put ((el element))
|
||||||
(let ((tag (tagname el)))
|
(let ((tag (tagname el)))
|
||||||
(start tag (attrs el))
|
(start tag (attrs el))
|
||||||
(dolist (c (body el))
|
(put (body el))
|
||||||
(put c))
|
|
||||||
(end tag)))
|
(end tag)))
|
||||||
|
|
||||||
(defun elem (tag &optional attrs body)
|
(defun elem (tag &optional attrs body)
|
||||||
|
@ -74,7 +73,7 @@
|
||||||
(defmacro make-elements (tags &optional (elem-fn 'elem))
|
(defmacro make-elements (tags &optional (elem-fn 'elem))
|
||||||
`(progn
|
`(progn
|
||||||
,@(mapcar (lambda (tag) ;`(make-element ,tag)) tags)))
|
,@(mapcar (lambda (tag) ;`(make-element ,tag)) tags)))
|
||||||
`(defun ,tag (attrs &rest body)
|
`(defun ,tag (&optional attrs &rest body)
|
||||||
(funcall (function ,elem-fn) ',tag attrs body)))
|
(funcall (function ,elem-fn) ',tag attrs body)))
|
||||||
tags)))
|
tags)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue