Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rksm/subprocess

Clojure lib for spawning subprocesses and listen to stdout and stderr via core.async
https://github.com/rksm/subprocess

Last synced: 3 months ago
JSON representation

Clojure lib for spawning subprocesses and listen to stdout and stderr via core.async

Awesome Lists containing this project

README

        

# subprocess

Small wrapper around Java processes. Starts a process and returns an atom map that provides access to the process object, it's exit state and core.async channels for stdout and stderr.

The main purpose of this lib is it to provide easy access to the output streams of a process, without having to think about pumping threads and such.

## Usage

Start and forget:

```clojure
(async-proc "echo" "123")
```

Listen on out with core.async:

```clojure
(let [proc (async-proc "bash" "-c" "echo 1; sleep .3; echo 2; sleep .3; echo 3")]
(future
(while (not (:exited? @proc))
(println "Got output" (async/