Fork me on GitHub
#chestnut
<
2017-09-20
>
rgm04:09:29

@featheredtoast thanks, I'll give that a go and report back.

rgm05:09:39

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).

rgm05:09:05

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.

featheredtoast05:09:54

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 😉

rgm17:09:33

@featheredtoast this is getting close, but isn't quite right... would appreciate feedback: https://github.com/plexus/chestnut/compare/master...rgm:shell-component-fix

rgm17:09:53

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

rgm17:09:09

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.

featheredtoast18:09:21

ah that is certainly problematic - thanks for looking in to that.

featheredtoast19:09:07

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.

featheredtoast19:09:27

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

rgm20:09:00

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.

rgm20:09:10

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.

rgm20:09:20

(fwiw I've fallen back on using find src -name "*.scss" | entr sassc path/to/input path/to/output > sassc.log 2>&1)

featheredtoast22:09:33

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

featheredtoast22:09:54

I'll investigate a rebuild of the shell components to rely on that soon.