The host services the Clojure tools need: a clock, digests, home-relative paths, a log directory, environment fingerprints, child processes, and the result envelope.
This library is STANDALONE. It runs as a plain JVM program (clojure -M -m com.blockether.vis.lang.clojure.cli), so nothing here may reach for an editor, an
agent or a sandbox — everything below is java.lang and clojure.core.
The host services the Clojure tools need: a clock, digests, home-relative paths, a log directory, environment fingerprints, child processes, and the result envelope. This library is STANDALONE. It runs as a plain JVM program (`clojure -M -m com.blockether.vis.lang.clojure.cli`), so nothing here may reach for an editor, an agent or a sandbox — everything below is java.lang and clojure.core.
(abbreviate-home path)path with the user's home directory collapsed to ~/, which is how every path
this library reports back reads. The home directory itself renders as ~/; a path
outside it passes through unchanged.
`path` with the user's home directory collapsed to `~/`, which is how every path this library reports back reads. The home directory itself renders as `~/`; a path outside it passes through unchanged.
(call-env-values env)The environment delta a call named, as plain {"NAME" value}. Values cross the CLI
as strings; a nil value means UNSET that variable for the child process.
The environment delta a call named, as plain `{"NAME" value}`. Values cross the CLI
as strings; a nil value means UNSET that variable for the child process.(ensure-log-date-dir!)(ensure-log-date-dir! instant)Create (once) and return today's log directory, <tmp>/vis-lang-clojure/YYYY-MM-DD
in UTC. Subprocess logs live outside the project so a REPL boot log never lands in
a working tree, and the date keeps a long-lived machine's logs sorted.
Create (once) and return today's log directory, `<tmp>/vis-lang-clojure/YYYY-MM-DD` in UTC. Subprocess logs live outside the project so a REPL boot log never lands in a working tree, and the date keeps a long-lived machine's logs sorted.
(env-difference running requested)Variable NAMES whose value differs between the env a live process is running with and the one a new start asked for. Both sides are FINGERPRINTS, so this compares digests and answers names — the only thing either side may keep.
Variable NAMES whose value differs between the env a live process is running with and the one a new start asked for. Both sides are FINGERPRINTS, so this compares digests and answers names — the only thing either side may keep.
(env-fingerprint values){NAME "<digest>"} for one resolved delta — its SHAPE without its values. This is
what a status prints and what a REUSED process is compared against, and both are
read by a model and written to a log, so the value itself can never appear: a name
set from a keychain must compare equal to itself and to nothing else. An unset name
fingerprints as "unset".
`{NAME "<digest>"}` for one resolved delta — its SHAPE without its values. This is
what a status prints and what a REUSED process is compared against, and both are
read by a model and written to a log, so the value itself can never appear: a name
set from a keychain must compare equal to itself and to nothing else. An unset name
fingerprints as "unset".(env-mismatch-refusal id running requested){:message :differing} when a REPL is already running with an env OTHER than the one
this start named, else nil. A live REPL is reused, never silently replaced, and an
env it was not started with is a different REPL. Names and digests only — a value
never reaches it.
`{:message :differing}` when a REPL is already running with an env OTHER than the one
this start named, else nil. A live REPL is reused, never silently replaced, and an
env it was not started with is a different REPL. Names and digests only — a value
never reaches it.(failure {:keys [error]})A failed call envelope: {:result nil :success? false :error {:message … :hint …}}.
A failure is DATA — an expected, actionable condition the caller can read and act on,
not a stack trace.
A failed call envelope: `{:result nil :success? false :error {:message … :hint …}}`.
A failure is DATA — an expected, actionable condition the caller can read and act on,
not a stack trace.(kill-process-tree! process)Destroy process and every process it started: TERM the descendants first, then the
process, and after a two-second grace KILL whatever is left. Waits for the tree to
actually exit, so a caller that reports "terminated" is telling the truth. Never
throws, and never loses an interrupt — a cancelled test run still tears its
subprocesses down.
Destroy `process` and every process it started: TERM the descendants first, then the process, and after a two-second grace KILL whatever is left. Waits for the tree to actually exit, so a caller that reports "terminated" is telling the truth. Never throws, and never loses an interrupt — a cancelled test run still tears its subprocesses down.
(now-ms)Wall-clock milliseconds. One spelling, so every timestamp in this library agrees.
Wall-clock milliseconds. One spelling, so every timestamp in this library agrees.
The budget for ONE test run — ten minutes, shared by the nREPL path and the owned CLI process so a single deadline covers a cold start (JVM boot, namespace loading, compilation) and the run itself. Overrunning it is reported as a STRUCTURED result — the wedged REPL, the killed process, the output that did arrive — never as an opaque kill, so the number says when we stop believing the suite will finish.
The budget for ONE test run — ten minutes, shared by the nREPL path and the owned CLI process so a single deadline covers a cold start (JVM boot, namespace loading, compilation) and the run itself. Overrunning it is reported as a STRUCTURED result — the wedged REPL, the killed process, the output that did arrive — never as an opaque kill, so the number says when we stop believing the suite will finish.
(sha256-hex x)Lowercase hex SHA-256 of x.
Lowercase hex SHA-256 of `x`.
(spawn! argv dir {:keys [env merge-stderr?]})Start argv in dir and answer its Process. :env adds or overrides environment
variables for the child (a nil value REMOVES one) and :merge-stderr? folds stderr
into stdout, so one pump captures a whole boot log in the order it was written.
Start `argv` in `dir` and answer its `Process`. `:env` adds or overrides environment variables for the child (a nil value REMOVES one) and `:merge-stderr?` folds stderr into stdout, so one pump captures a whole boot log in the order it was written.
(success {:keys [result]})A successful call envelope: {:result … :success? true :error nil}. The CLI turns it
into the JSON one request answers with.
A successful call envelope: `{:result … :success? true :error nil}`. The CLI turns it
into the JSON one request answers with.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 |