Subprocesses, portable.
sh (run-to-completion) works on every host. spawn (a long-lived child
with piped stdin/stdout) is the one MCP stdio transports need, and is the
known gap on cljgo — see the cljgo work item in toolnexus ADR 0009.
Subprocesses, portable. `sh` (run-to-completion) works on every host. `spawn` (a long-lived child with piped stdin/stdout) is the one MCP stdio transports need, and is the known gap on cljgo — see the cljgo work item in toolnexus ADR 0009.
(alive? child)True while the child is running.
True while the child is running.
(close! child)Close the child's stdin, wait for it to exit, and return the exit code.
Close the child's stdin, wait for it to exit, and return the exit code.
(read-line! child)Block for one line from the child's stdout, WITHOUT the terminator. nil at EOF.
Block for one line from the child's stdout, WITHOUT the terminator. nil at EOF.
(send-line! child s)Write s + newline to the child's stdin and flush. Returns nil.
Write `s` + newline to the child's stdin and flush. Returns nil.
(sh command)(sh command {:keys [in dir env] :as opts})Run command (a vector) to completion. Returns {:out :err :exit}.
Never throws on a non-zero exit — that is a normal result.
opts: :in (string on stdin) :dir :env
Run `command` (a vector) to completion. Returns {:out :err :exit}.
Never throws on a non-zero exit — that is a normal result.
opts: :in (string on stdin) :dir :env(spawn command)(spawn command {:keys [dir env]})Start command (a vector) as a LONG-LIVED child with piped stdin/stdout and
return a child handle — a map of closures, see above. This is what a
line-delimited JSON-RPC transport (MCP stdio) requires; sh cannot express it.
opts: :dir :env
Start `command` (a vector) as a LONG-LIVED child with piped stdin/stdout and return a child handle — a map of closures, see above. This is what a line-delimited JSON-RPC transport (MCP stdio) requires; `sh` cannot express it. opts: :dir :env
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |