Fork me on GitHub

Hi, anyone here using Steven Collins' ? I'm using it pretty much the way it apparently is supposed to: (defn -main [& args] (println "Starting the system. With restart watcher.") (let [started (sys/start (system/example-system {}))] (restart/watch (var -main) started))) Once I call (-main) from my CIDER-REPL the system starts and reloading/restarting works pretty much as advertised. My REPL however is stuck in some evaluation, so I cannot evaluate anything inside my buffers. Any idea on how to investigate this?


If you call (future (-main)) it should execute on a thread and leave your REPL unblocked.


(but then you can't easily stop the background process)


My recommendation is always: do not use watchers/reload machinery. Provide a top-level def for the system Component, and then alter-var-root .. component/start / alter-var-root .. component/stop on it manually as needed. Most folks have some convenience functions, sometimes in their user.clj file, that wrap that in simple start / stop functions @services


(and if you are careful with function var references, you shouldn't need to restart your component system at all: just start it once and then eval every change you make into the running program)


Why am I not surprised to hear you discourage the use of automatic reloading 😉 … I had actually tried using future (and thread) myself but I tried wrapping just the (restart/watch (var -main) started) part, which didn't work… your solution works better but gives me no more than your second approach would (probably due to some quirk with the template I'm trying to get working here) I have, however, gotten your second approach to work successfully… and it's more than enough. Many thanks for your help on this occasion (and previous ones). Cheers!