cVisor Clojure SDK — java.lang.foreign (FFM) bindings over the libcvisor C ABI. Linux-only at runtime; requires JDK 22+.
(require '[cvisor.core :as cvisor]) (with-open [sb (cvisor/sandbox)] (:stdout (cvisor/run sb "echo hello"))) ; => "hello\n"
cVisor Clojure SDK — java.lang.foreign (FFM) bindings over the libcvisor C ABI.
Linux-only at runtime; requires JDK 22+.
(require '[cvisor.core :as cvisor])
(with-open [sb (cvisor/sandbox)]
(:stdout (cvisor/run sb "echo hello"))) ; => "hello\n"(run sb command)(run sb command {:keys [timeout-ms]})Run a shell command in the sandbox, blocking until it exits. Returns {:stdout String, :stderr String, :exit-code long, :stdout-bytes bytes, :stderr-bytes bytes}. Options: :timeout-ms — SIGKILL the guest after this many milliseconds (exit code 137).
Run a shell command in the sandbox, blocking until it exits. Returns
{:stdout String, :stderr String, :exit-code long, :stdout-bytes bytes,
:stderr-bytes bytes}. Options:
:timeout-ms — SIGKILL the guest after this many milliseconds (exit code 137).(sandbox)Create a sandbox. Free it with close (Closeable, so with-open works).
Create a sandbox. Free it with `close` (Closeable, so with-open works).
(set-allow-network! sb allow?)Enable or disable outbound INET/INET6 networking for the sandbox (default on). When off, the guest's attempts to create internet sockets are denied.
Enable or disable outbound INET/INET6 networking for the sandbox (default on). When off, the guest's attempts to create internet sockets are denied.
(set-log-level! sb level)Set the sandbox log level: :debug (or "DEBUG") enables logging, anything else disables it.
Set the sandbox log level: :debug (or "DEBUG") enables logging, anything else disables it.
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 |