cl-process-kit¶
cl-process-kit is an SBCL-only process execution toolkit for Common Lisp,
built on the nerima-lisp
cl-boundary-kit (clock/
sleeper boundaries) and cl-log-kit
(structured logging). It gives Common Lisp the same small, timeout-aware
surface for launching external commands that Python's subprocess.run() and
Node.js's child_process.spawn() give their own ecosystems.
New to cl-process-kit?
Add it to your source registry, then run your first timeout-guarded command in a few lines:
Continue with Installation → Quick Start → Command Specifications.
Explore the docs¶
-
Getting Started
Nix flake and ASDF/local-checkout install paths, plus a first timeout-guarded
runcall. -
Running Commands
command-specconstruction, the synchronousrun/run-command/run-shellfamily, and the checked variants that signal on failure. -
Async, Cancellation & Pipelines
Low-level
spawn/communicate, the event-drivenprocess-taskAPI, cooperative cancellation tokens, and multi-stagerun-pipeline. -
Native Backends & Observability
The
posix_spawn-based native trampoline for low-level process setup, the optional native PTY backend for interactive/job-control programs, and structuredcl-log-kitobservability hooks.
Design intent¶
Most Common Lisp code that shells out reaches straight for
sb-ext:run-program and then hand-rolls timeout polling, SIGTERM/SIGKILL
escalation, and output capture every time. cl-process-kit extracts that
pattern once, the way modern languages ship it in their standard library:
runmirrors Python'ssubprocess.run(..., timeout=...): synchronous, captures stdout/stderr as strings or octet vectors, and can raise (or report) a timeout after escalating from SIGTERM to SIGKILL.spawnmirrors Node'schild_process.spawn(): fire-and-forget, returns a handle immediately, and leaves streaming/job-control to the caller.- Both put the child process in its own process group, so a timeout kills not just the immediate child but anything it has forked (a shell running a pipeline, for example) — no orphaned processes left behind after a deadline.
run's polling loop takesclockandsleeper—cl-boundary-kitclock and sleeper boundary objects — as explicit arguments, so tests can replace real time withcl-boundary-kit:make-fake-clock/make-test-sleeperand exercise the timeout/escalation branches without waiting on the wall clock.- Process lifecycle events (launch, timeout/cancellation escalation,
pipeline stage failure) are optionally observable as
cl-log-kitstructured log records by binding*process-logger*; the defaultnillogger keeps the library silent, exactly as before.
It exists to consolidate the "timeout-guarded process launch" logic that had
been reimplemented ad hoc across several sister projects (nshell,
cl-tmux, private-trade-fx, ...) into one reusable, tested library.
Capability map¶
command-specconstruction with validated stdio/environment/directory policies — see Command Specifications.- Synchronous
run,run/checked,run-shell,run-command,run-command/checked— see Synchronous Execution. - Low-level
spawn/spawn-command, blockingcommunicate, and the event-drivencommunicate-async/process-task/await-processAPI — see Asynchronous Execution. - Cooperative
cancellation-tokens that terminate a command's whole process group — see Cancellation. - Multi-stage
run-pipeline/run-pipeline/checkedwith per-stage results — see Pipelines. - A
posix_spawn-based native trampoline (spawn-native) for session/ process-group/credential/resource-limit setup with typed launch-failure reporting — see Native Spawn Trampoline. - An optional native controlling-terminal PTY backend
(
cl-process-kit/pty) — see PTY Backend. - Optional
cl-log-kitstructured observability via*process-logger*— see Structured Logging. - A full
process-errorcondition hierarchy andprocess-result/pipeline-resultaccessors — see Results and Conditions.
Nix workflow¶
The flake.nix
at the repository root packages cl-process-kit as a Nix flake:
nix develop— a devShell with SBCL and a C compiler onCL_SOURCE_REGISTRY, pinned to the testedcl-weave,cl-boundary-kit,cl-log-kit, andcl-tty-kitversions.nix build— thecl-process-kitASDF-system package (packages.default) and the optional nativecl-process-kit-ptyshared library (packages.cl-process-kit-pty).nix flake check— the full checkout test suite (checks.checkout-tests) and the PTY integration suite (checks.pty-tests) as reproducible derivations.nix run ./nix run .#test— runsrun-tests.lispagainst the pinned dependency set.nix build .#docs— builds this documentation site with MkDocs (Material) in--strictmode, so broken links fail the build.
License¶
MIT. See LICENSE.