I wish to spawn a long-running sub-process from clojure and communicate with this process via the standard streams.
Using the conch library, I can
spawn and read the process, and read data from the out stream:
(def my-process (sh/proc "my_dumb_process"))
; read 10 lines from my-process's stdout. Will block until 10 lines taken
(take 10 (line-seq (clojure.java.io/reader (:out p))))
I want to invoke an asynchronous callback whenever my-process prints to stdout - whenever data is available in the stdout stream.
I'm a bit new to clojure - is there an idiomatic clojur-ey way to do this? I've looked through core.async which is nice but I can't find a non-blocking solution for streams.