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.
A running child process with open pipes.
A running child process with open pipes.
(alive? this)True while the child is running.
True while the child is running.
(close! this)Close stdin, wait for exit, return the exit code.
Close stdin, wait for exit, return the exit code.
(read-line! this)Block for one line from the child's stdout. nil at EOF.
Block for one line from the child's stdout. nil at EOF.
(send-line! this s)Write s + newline to the child's stdin and flush.
Write s + newline to the child's stdin and flush.
(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. 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. 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 |