Expand description
Native implementation of clojure.rust.process: run a host program and
capture its result. The substrate under clojure.java.shell/sh.
(run argv) / (run argv {:in "..." :dir "..." :env {"NAME" "value"} :out-bytes true})
returns {:exit n :out "..." :err "..."}. A non-zero exit is data, not an
error. :env replaces the child environment (JVM sh semantics); the
program is still found on the parent’s PATH. A child killed by signal N
reports exit 128+N. The program is started by argv, never through a shell.
stdout/stderr are decoded as UTF-8, lossily; :out-bytes true returns
stdout as a byte array instead.
Strata: collect reads a Request value out of the Clojure arguments,
command and exit_code / result_value are pure promotions, execute
is the only boundary that touches the OS, builtin_run composes them.
Structs§
- Request
- One program invocation, independent of how it was asked for.
Constants§
- RUN_
NAME - The native fn’s name, which is also its entry in the transaction policy
denylist (
cljrs_runtime::env::policy::check_native).
Functions§
- collect
- Read a
Requestout of(run argv)/(run argv opts). - command
- The
Commanda request describes. Builds, never spawns. - execute
- Spawn
cmd, feedstdin, drain stdout/stderr, wait. - exit_
code - A process status as the integer
shreports: the exit code, or 128+N for a child killed by signal N. - register
- result_
value - The
{:exit :out :err}map for a finished process.