Common Lisp: Hunchentoot and the REPL - When I start the server I get log output in the REPL and can't use the REPL any more

StackOverflow https://stackoverflow.com/questions/17594533

Pergunta

Like a few of the askers on here, I'm new to Lisp. I'm going through the Practical Common Lisp book, but took a sidestep to see how easy it would be to set up a web app, so I've been following this tutorial, as well as the updated version here.

When I get to the point where I start the server, my REPL dies, and I can't then push anything onto the *dispatch-table*.

So basically, I have code working great in the REPL, adding objects to a list, retrieving them, etc., then I start the server using

(setf *web-server* (start (make-instance 'hunchentoot:acceptor :port 8080)))

which works great, and I can access it on http://localhost:8080. However when I access it, the logs print to the REPL and I'm unable from that point to actually use the REPL. So for example, following Adam Petersen's post, I can't then

(push (create-prefix-dispatcher "/retro-games.htm" 'retro-games) *dispatch-table*)

because the REPL is unresponsive. I've tried starting the server from different windows (i.e. from SBCL in terminal) but then it's unaware of the context I'm in - it doesn't understand the package I'm working on or any of my code.

I'm using a slightly non-standard setup; I'm on OSX and using Sublime Text 2 with SublimeREPL and SBCL (because I'm really not into Emacs and ST2 is great!). I've described how I put it all together here - but I'm really only posting that just in case, I'd be surprised if it's my setup causing problems as opposed to some basic thing I'm missing.

Anyway, I understand that I could go ahead and set up hunchentoot in a more production-like environment, and have seen some posts detailing that and accessing the REPL remotely, but I was hoping there would be something simpler for messing around with that I've just missed.

Foi útil?

Solução

Make sure your SBCL was compiled with thread support. When running single-threaded, the Hunchentoot request handling loop does not return to the REPL.

Threading is not the default setting in the binaries from http://www.sbcl.org/ for Mac OS X. On Mac OS X, I usually download the sbcl.org binaries to get started, then download the sources and rebuild with ./make.sh --fancy to get a number of fancy features, including threads. See the INSTALL document in the sources for details.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top