Skip to main content

Module loop_dispatch

Module loop_dispatch 

Source
Expand description

Shellout dispatcher that wraps the bash driver-lib contract.

§Design: the shellout seam (grilled decision 8)

The Rust Dispatcher trait exists so a future daemon/PTY implementation can be wired in as a drop-in replacement without touching the loop runtime or the TargetQueue. This file implements the bash-shellout side only: it sources driver-<name>.sh and calls driver_invoke, delegating all session logic to the bash lib. The Rust side NEVER reimplements driver behavior; it only manages process lifecycle, env passthrough, and exit-code collection.

The seam is stable once the trait is locked (Task 1.1). A future PTY dispatcher can implement Dispatcher + Session and be swapped in by the CLI flag --dispatcher pty without changing any other code.

§Binary resolution (preflight)

Mirrors scripts/run-target-loop.sh:144-150. The Rust side validates the driver whitelist and binary availability before any dispatch, so a missing binary fails loudly at startup rather than inside iteration N.

Structs§

ShelloutDispatcher
Dispatcher that sources a driver lib and calls driver_invoke in bash.
ShelloutSession
A live session wrapping a bash driver_invoke child process.

Constants§

PICK_ARGV
The exact verb this file shells, as one named constant.

Functions§

driver_default_max
Query driver_default_max() from the driver lib via a single bash shellout.
preflight
Validate the driver name and confirm the driver lib file exists, the driver binary is on PATH, and the lib defines driver_invoke.
resolve_driver_binary
Resolve the binary name for a given driver name.
which_binary
Walk $PATH to find a binary. Returns Some(path) on success. Does not use an external crate; pure std.