@featheredtoast thanks, I'll give that a go and report back.
well, just putting into the ShellComponent
defrecord
(stop [this]
(assoc this :running false))
works to allow (reset)
to function, at the cost of starting a new lein sassc
process each reset (which makes sense).guess if I just nab the exit code from the clojure.java.shell/sh
return map and stash it away someplace I can kill it on the stop
call.
core should probably do the same at some point soon -- you should be able to stash it away in the component 'this' object similar to how :running
is. A PR would be grand when you figure out a good way 😉
@featheredtoast this is getting close, but isn't quite right... would appreciate feedback: https://github.com/plexus/chestnut/compare/master...rgm:shell-component-fix
I had no idea sub-process management was not a straightforward thing. For the record, same result (lein process dead, java process still living) if I use lein trampoline auto sassc once
which I guess makes sense to me now that I've verbalized it... the handle to the process that comes back from spawn
is the lein process with or without trampoline
... I'd just assumed that lein was the parent process and they'd both go away.
ah that is certainly problematic - thanks for looking in to that.
As the sass/less components grow, the more I'm tempted to pull them out and work on them as separate libraries here as well.
I'd be tempted to attack this from another angle - rather than rely on lein sassc auto, have yet another file watcher to watch for changes and run the sass compiler once per change, so we don't have a process outside of the system that we'd have to maintain as well
yeah, ShellComponent doesn't seem to be a great way to handle a separate long-lived watcher process; seems better suited to a fire-once that exits on its own.
clojure.java.shell/sh
invoking sassc
directly would be fine since there's no real need to keep track of the state of that process.
(fwiw I've fallen back on using find src -name "*.scss" | entr sassc path/to/input path/to/output > sassc.log 2>&1
)
entr
is pretty great http://entrproject.org
Nice
I also built a generic file watcher component, if you wanted that in your system that might solve this issue, without any external processes running https://github.com/featheredtoast/repl-watcher
I'll investigate a rebuild of the shell components to rely on that soon.