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.
run_command’s cancel branch fires,terminate_treeSIGKILLs the child’s whole process group, the driver is aborted, andToolOutcome::Cancelledflows back to the reducer. (The child is deliberately NOTkill_on_drop, so a Ctrl+B-detached command survives a clean shutdown — see the spawn site.)
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.