On Mon, Jul 7, 2008 at 4:45 AM, Robin Lee Powell rlpowell@digitalkingdom.org wrote:
So I'm writing code that'll be largely "setup dispatch table, run hunchentoot". I don't really want to do anything after hunchentoot is launched other than, well, hunchentoot, but it seems to thread itself off (fine) and then the REPL terminates (not so fine).
I'd like to loop around "Is Hunchentoot still alive?", but I don't know how to test for whether that thread is still running, or if that's even the right kind of test.
This is SBCL on Linux, in case it matters.
There are lots of ways to do this; on our systems we run lisp on a separate tty (using /etc/inittab) - this has the added benefit of having /sbin/init restarting it if it dies/is killed.
You could also run lisp under GNU screen, which would allow you to connect to it and see the repl if there were any errors.
Another option is you could run hunchentoot directly instead of creating a thread for it. If you looked at server.lisp you could figure out how this is done just by looking at start-server.
Another option is you could run the sbcl function (sb-ext:process-wait (hunchentoot::server-listener s))
I recommend keeping the repl around; we had a number of problems when we deployed that were fixed "in the field" by connecting to the repl and patching our app while it was running.