planck.shell

Planck Shell capability.

Vars

*sh-dir*
*sh-env*
sh
sh-async
with-sh-dir
with-sh-env

Vars

*sh-dir*

*sh-env*

sh

([& args])

Launches a sub-process with the supplied arguments.

Parameters: cmd, <options>
cmd the command(s) (Strings) to execute. will be concatenated together.
options optional keyword arguments– see below.

Options are:
:in may be given followed by any legal input source for planck.io/copy, e.g. IInputStream or IReader created using planck.io, File, or string, to be fed 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.
:out-enc option may be given followed by 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.
:env override the process env with a map of String: String.
:dir override the process dir with a String or planck.io/File.
if the command can be launched, sh returns a map of
:exit => sub-process's exit code
:out => sub-process's stdout (as String)
:err => sub-process's stderr (String via platform default encoding), otherwise it throws an exception

Spec
args: (cat :cmd (+ string?) :opts (* ::sh-opt))
ret: (keys :req-un [::exit ::out ::err])

sh-async

([& args])

Launches a sub-process with the supplied arguments.

Parameters: cmd, <options>, cb
cmd the command(s) (Strings) to execute. will be concatenated together.
options optional keyword arguments– see below.
cb the callback to call upon completion

Options are:
:in may be given followed by any legal input source for planck.io/copy, e.g. IInputStream or IReader created using planck.io, File, or string, to be fed 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.
:out-enc option may be given followed by 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.
:env override the process env with a map of String: String.
:dir override the process dir with a String or planck.io/File.
if the command can be launched, sh returns a map of
:exit => sub-process's exit code
:out => sub-process's stdout (as String)
:err => sub-process's stderr (String via platform default encoding), otherwise it throws an exception

Spec
args: (cat :cmd (+ string?) :opts (* ::sh-opt) :cb fn?) ret: nil?

with-sh-dir

([dir & forms])

Macro

Sets the directory for use with sh, see sh for details.

with-sh-env

([env & forms])

Macro

Sets the environment for use with sh, see sh for details.