Skip to main content

Module slot_cmd

Module slot_cmd 

Source
Expand description

amont slot run and amont slots (ADR-0014): the host slots for any command, and who holds them.

amont slot run [--weight N] [--max-wait S | --now] -- <cmd…> waits for a slot, runs the command with GREENHARNESS_HOST_SLOT=held, passes its exit status through and frees the slot when the command exits. The wrapper alone holds the slot: its descriptors are close-on-exec, so a daemon the command leaves behind never keeps it. A wait ends, with exit 75 and nothing run, when the line makes no progress for 300 s or --max-wait runs out (default 90 s, under Claude Code’s 120 s Bash timeout) (ADR-0022). --now skips the queue up front: the command runs at once, unqueued, journalled now.

Constants§

BUSY_EXIT
Exit status for “the host stayed busy; nothing ran” (EX_TEMPFAIL).
DEFAULT_MAX_WAIT
The default --max-wait: under Claude Code’s 120 s Bash timeout, so a wrapped command is never killed while it is still queued.
QUEUE_FAILED_EXIT
Exit status for “the slot queue failed after it was joined; nothing ran” (EX_IOERR): unlike a busy host, retrying the same command fails the same way.

Functions§

cores_phrase
amont slots [--json]. 6 cores, 12 threads: the threads only where they differ from the cores (SMT), and a short tag when the count did not come from plain detection, so the slots header stays inside 80 columns. doctor names the key.
doctor_line
The host sizing lines doctor prints, one per key so each fits in 80 columns: the core count and the slot count, each with the source that set it. Any warning about either key is printed separately, once, by host_slots::host_sizing.
slot_command
amont slot <args>.
slots_command
split_at_dashes
The arguments before --, and the command after it.