Expand description
execute_command tool.
The ExecContext::token races the subprocess wait in a select!.
When the user Ctrl+C’s:
- Reducer emits
Cmd::CancelScope(turn). - Effect runner cancels the turn’s scope token.
- This tool’s select! branch fires, the
Commandis dropped,kill_on_drop(true)reaps the child, andToolOutcome:: Cancelledflows back to the reducer.
End-to-end latency: microseconds plus whatever it takes SIGKILL
to arrive. No polling loop to “forget” to include.
The dangerous-command blocklist is defense-in-depth, not a
security boundary: the real boundary is the user’s decision to
run Mermaid with shell access. But the known destructive shapes
(rm -rf /, fork bombs, dd to device, etc.) are cheap to catch
upfront.
Structs§
- Execute
Command Tool execute_command— spawn a shell, run a command, capture output.