Liking cljdoc? Tell your friends :D
Clojure only.

clj-shell.shell


shclj

(sh & args)

Passes the given strings to Runtime.exec() to launch a sub-process.

Options are

:in may be given followed by a String or byte array specifying input to be fed to the sub-process's stdin. If :in isn't a String or a byte array the value is passed to the clojure.java.io/input-stream function and directly copied to the sub-process's stdin. :in-enc option may be given followed by a String, used as a character encoding name (for example "UTF-8" or "ISO-8859-1") to convert the input string specified by the :in option to the sub-process's stdin. Defaults to UTF-8. If the :in option provides a byte array, then the bytes are passed unencoded, and this option is ignored. :out-enc option may be given followed by :bytes or a String. If a String is given, it will be used as a character encoding name (for example "UTF-8" or "ISO-8859-1") to convert the sub-process's stdout to a String which is returned. If :bytes is given, the sub-process's stdout will be stored in a byte array and returned. Defaults to UTF-8. :env override the process env with a map (or the underlying Java String[] if you are a masochist). :dir override the process dir with a String or java.io.File. :out-fn a custom one argument function to process the stdout java.io.InputStream of the java.lang.Process. The stream obtains data piped from the standard output stream (stdout) of the process represented by the underlying Process object. You don't need to take care of closing the java.io.InputStream. :err-fn a custom one argument function to process the stderr java.io.InputStream of the java.lang.Process. The stream obtains data piped from the error output stream (stderr) of the process represented by the underlying Process object. You don't need to take care of closing the java.io.InputStream.

You can bind :env or :dir for multiple operations using with-sh-env and with-sh-dir.

sh returns a map of :exit => sub-process's exit code :out => sub-process's stdout (as byte[] or String) :err => sub-process's stderr (String via platform default encoding)

Passes the given strings to Runtime.exec() to launch a sub-process.

Options are

:in      may be given followed by a String or byte array specifying input
         to be fed to the sub-process's stdin. If :in isn't a String or
         a byte array the value is passed to the clojure.java.io/input-stream
         function and directly copied to the sub-process's stdin.
:in-enc  option may be given followed by a String, used as a character
         encoding name (for example "UTF-8" or "ISO-8859-1") to
         convert the input string specified by the :in option to the
         sub-process's stdin.  Defaults to UTF-8.
         If the :in option provides a byte array, then the bytes are passed
         unencoded, and this option is ignored.
:out-enc option may be given followed by :bytes or a String. If a
         String is given, it will be used as a character encoding
         name (for example "UTF-8" or "ISO-8859-1") to convert
         the sub-process's stdout to a String which is returned.
         If :bytes is given, the sub-process's stdout will be stored
         in a byte array and returned.  Defaults to UTF-8.
:env     override the process env with a map (or the underlying Java
         String[] if you are a masochist).
:dir     override the process dir with a String or java.io.File.
:out-fn  a custom one argument function to process the stdout
         java.io.InputStream of the java.lang.Process. The stream
         obtains data piped from the standard output stream (stdout) of
         the process represented by the underlying Process object.
         You don't need to take care of closing the java.io.InputStream.
:err-fn  a custom one argument function to process the stderr
         java.io.InputStream of the java.lang.Process. The stream
         obtains data piped from the error output stream (stderr) of
         the process represented by the underlying Process object.
         You don't need to take care of closing the java.io.InputStream.

You can bind :env or :dir for multiple operations using with-sh-env
and with-sh-dir.

sh returns a map of
  :exit => sub-process's exit code
  :out  => sub-process's stdout (as byte[] or String)
  :err  => sub-process's stderr (String via platform default encoding)
sourceraw docstring

sh*clj

(sh* & args)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close