Liking cljdoc? Tell your friends :D

clojure.java.process

A process invocation API wrapping the Java process API.

The primary function here is 'start' which starts a process and handles the streams as directed. It returns a map that contains keys to access the streams (if available) and the Java Process object. It is also deref-able to wait for process exit.

Helper functions are available to 'capture' the output of the process stdout and to wait for an 'ok?' non-error exit. The 'exec' function handles the common case of `start'ing a process, waiting for process exit, capture and return stdout.

A process invocation API wrapping the Java process API.

The primary function here is 'start' which starts a process and handles the
streams as directed. It returns a map that contains keys to access the streams
(if available) and the Java Process object. It is also deref-able to wait for
process exit.

Helper functions are available to 'capture' the output of the process stdout
and to wait for an 'ok?' non-error exit. The 'exec' function handles the common
case of `start'ing a process, waiting for process exit, capture and return
stdout.
raw docstring

captureclj

(capture input-stream & opts)

Read from input-stream until EOF and return a String (or nil if 0 length). Takes same opts as clojure.java.io/copy - :buffer and :encoding

Read from input-stream until EOF and return a String (or nil if 0 length).
Takes same opts as clojure.java.io/copy - :buffer and :encoding
sourceraw docstring

execclj

(exec & opts+args)

Execute a command and on successful exit, return the captured output, else throw RuntimeException. Args are the same as 'start' and options if supplied override the default 'exec' settings.

Execute a command and on successful exit, return the captured output,
else throw RuntimeException. Args are the same as 'start' and options
if supplied override the default 'exec' settings.
sourceraw docstring

from-fileclj

(from-file file)

Coerce f to a file per clojure.java.io/file and return a ProcessBuilder.Redirect reading from the file. This can be passed to 'start' in :in.

Coerce f to a file per clojure.java.io/file and return a ProcessBuilder.Redirect reading from the file.
This can be passed to 'start' in :in.
sourceraw docstring

ok?clj

(ok? process-map)

Given the map returned from 'start', wait for the process to exit and then return true on success

Given the map returned from 'start', wait for the process to exit
and then return true on success
sourceraw docstring

startclj

(start & opts+args)

Starts an external command as args and optional leading opts map:

:in - a ProcessBuilder.Redirect (default = :pipe) or :inherit :out - a ProcessBuilder.Redirect (default = :pipe) or :inherit :discard :err - a ProcessBuilder.Redirect (default = :pipe) or :inherit :discard :stdout :dir - directory to run the command from, default="." :env - {env-var value} of environment variables (all strings)

Returns an ILookup containing the java.lang.Process in :process and the streams :in :out :err. The map is also an IDeref that waits for process exit and returns the exit code.

Starts an external command as args and optional leading opts map:

  :in - a ProcessBuilder.Redirect (default = :pipe) or :inherit
  :out - a ProcessBuilder.Redirect (default = :pipe) or :inherit :discard
  :err - a ProcessBuilder.Redirect (default = :pipe) or :inherit :discard :stdout
  :dir - directory to run the command from, default="."
  :env - {env-var value} of environment variables (all strings)

Returns an ILookup containing the java.lang.Process in :process and the
streams :in :out :err. The map is also an IDeref that waits for process exit
and returns the exit code.
sourceraw docstring

to-fileclj

(to-file file & {:keys [append] :as opts})

Coerce f to a file per clojure.java.io/file and return a ProcessBuilder.Redirect writing to the file. Set ':append' in opts to append. This can be passed to 'start' in :out or :err.

Coerce f to a file per clojure.java.io/file and return a ProcessBuilder.Redirect writing to the file.
Set ':append' in opts to append. This can be passed to 'start' in :out or :err.
sourceraw docstring

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

× close