chestnut

rgm 2017-09-20T04:05:29.000221Z

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

rgm 2017-09-20T05:08:39.000126Z

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

rgm 2017-09-20T05:10:05.000127Z

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.

👍 1
2017-09-20T05:24:54.000140Z

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 😉

rgm 2017-09-20T17:22:33.000009Z

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

rgm 2017-09-20T17:23:53.000280Z

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

rgm 2017-09-20T17:25:09.000326Z

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.

2017-09-20T18:58:21.000349Z

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

2017-09-20T19:00:07.000720Z

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.

2017-09-20T19:01:27.000058Z

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

rgm 2017-09-20T20:50:00.000510Z

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.

rgm 2017-09-20T20:51:10.000181Z

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.

rgm 2017-09-20T20:53:20.000136Z

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

rgm 2017-09-20T20:53:42.000244Z

entr is pretty great http://entrproject.org

2017-09-20T22:18:38.000017Z

Nice

2017-09-20T22:19:33.000332Z

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

2017-09-20T22:20:54.000031Z

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