clojure -- how to run a program without piping it's output? clojure -- how to run a program without piping it's output? shell shell

clojure -- how to run a program without piping it's output?


Also see this third party library

https://github.com/Raynes/conch

It provides direct access to the streams.


EDIT: Before Clarification

You can wrap the shell command with a sh and then pipe to /dev/null like so:

 (clojure.java.shell/sh "sh" "-c" "echo hello > /dev/null") ;; {:exit 0, :out "", :err ""}

This will silence the output before getting to clojure.

EDIT: After Clarification

Passing output and stderr to print should work as long as the output comes out quickly enough. If you want something with continuous output of error messages and standard output, looking at the source for the "sh" function should help.

Personally, I would make my own version of clojure.java.shell/sh and for each stream, create a thread that pipes the output directly to out using something like IOUtils.copy from org.apache.commons.io.IOUtilsin