diff --git a/priv/help/repl-extempore.txt b/priv/help/repl-extempore.txt index ababd05..77029cf 100644 --- a/priv/help/repl-extempore.txt +++ b/priv/help/repl-extempore.txt @@ -5,12 +5,17 @@ Built-in functions: (call body) -- make an explicitly blocking call to Extempore, with 'body' being a valid Extempore expression +(check-xt) -- check on the status of Extempore (no response indicates a health + problem, possibly requiring a restart of the 'extempore' binary) +(eom) -- alias for '(term)' (exit) -- alias for '(quit)' (h) -- alias for '(help)' (help) -- display this information (quit) -- quit the Extempore REPL and return to the LFE REPL (run file) -- load the code in the given file and run in Extempore -(v) -- alias for '(version') +(term) -- send message-terminating character sequence to force Extempore + end-of-message (useful when troubleshooting) +(v) -- alias for '(version)' (version) -- display all the version info for undertone Extempore support: diff --git a/src/undertone/repl/extempore.lfe b/src/undertone/repl/extempore.lfe index cd61324..b5c3017 100644 --- a/src/undertone/repl/extempore.lfe +++ b/src/undertone/repl/extempore.lfe @@ -23,6 +23,7 @@ (case (mref sexp 'tokens) ('() 'empty) (`("call" . ,_) (xt-blocking-eval sexp)) + ('("check-xt") 'check-xt) ('("eom") 'term) ('("exit") 'quit) ('("h") 'help) @@ -53,6 +54,7 @@ (defun print (result) (case result ('() 'ok) + ('check-xt (check-extempore)) ('empty 'ok) ('help (help)) ('quit 'ok) @@ -80,6 +82,9 @@ ;;;::=- shell functions -=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;::=--------------------=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun check-extempore () + (xt.msg:async "#(health ok)")) + (defun help () (lfe_io:format "~s" `(,(binary_to_list (undertone.sysconfig:read-priv diff --git a/src/xt/msg.lfe b/src/xt/msg.lfe index c564373..188ae05 100644 --- a/src/xt/msg.lfe +++ b/src/xt/msg.lfe @@ -17,14 +17,14 @@ (defun rcv-delim () #b(0)) (defun async (str) - (log-debug "Casting ~s ..." `(,str)) + (log-debug "Casting: ~s" `(,str)) (tcp-client:cast-msg (payload str))) (defun payload (str) (binary:list_to_bin (++ str (xmit-delim)))) (defun sync (str) - (log-debug "Calling ~s ..." `(,str)) + (log-debug "Calling: ~s" `(,str)) (tcp-client:call-msg (payload str))) ;;;;;::=------------------------------------=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -36,7 +36,10 @@ ("Welcome to extempore!" (progn (timer:sleep 500) (undertone.sysconfig:render-banner))) - (_ 'ok))) + ("#(health ok)" (log-notice "Extempore TCP server connection healthy")) + (_ (progn + (log-debug "No special packet handling for parsed value") + 'ok)))) (defun parse-response ((packet `#(,reporter-mod ,reporter-func))