babashka / pod-babashka-filewatcher

Babashka filewatcher pod based on Rust notify
Eclipse Public License 1.0
23 stars 1 forks source link

Keeping the watcher alive? #6

Closed russmatney closed 4 years ago

russmatney commented 4 years ago

Thanks a ton for this repo and bababashka at large - it's been a boon for productivity and clojure joy!

In trying to get this filewatcher working, I'm struggling to keep the process alive. It works great (logging file-changes) in the repl, but when run as a bb script, it exits immediately. I've created a simple example repo here.

Is there a typical/recommended approach to keeping bb scripts alive for processes like these? The babashaka/wait namespace seems close, but is specific to files and ports at the moment. I expect most usage while developing is that it works against a repl just fine.

My use-case is keeping assets always up to date while working on another project - I'd expect to be able to run a watch command in the background indefinitely, until interrupting the process via C-c.

borkdude commented 4 years ago

@russmatney

You can just put @(promise) at the bottom of your script. This will block until you terminate the script via SIGINT (Ctrl-C)

borkdude commented 4 years ago

Thanks for the positive feedback btw!

russmatney commented 4 years ago

This works great! Thanks for the quick response :)

ejuarezg commented 1 year ago

I'm glad I found this post. I also had the same issue.