Expand description
A ShellBackend implementation for local processes.
Originates from the same inline tokio::process::Command flow historically used in
the bash tool, but moves process management, buffered reads, and exit
synchronization into the backend layer so that BashTool interacts only through the
ShellBackend trait — a local shell execution backend.
Internal data structures:
LocalShellBackend.terminals: Mutex<HashMap<TerminalId, Arc<TerminalState>>>Global terminal table.TerminalStateholds the output buffer,exitstatus,exit_notify, andkill_notify.- Each terminal spawns a reader task: blocks reading stdout/stderr → writes into
buffer → waits on
kill_notifyor both EOFs → callschild.wait()→ writesexit→ callsnotify_waiters(). The child is exclusively owned by the reader task to avoid lock contention.
Structs§
- Local
Shell Backend - Local shell backend: each command spawns a
sh -cchild process, with state managed in theterminalstable untilrelease.