Skip to main content

Module exec

Module exec 

Source
Expand description

execute_command tool.

The ExecContext::token races the subprocess wait in a select!. When the user Ctrl+C’s:

  1. Reducer emits Cmd::CancelScope(turn).
  2. Effect runner cancels the turn’s scope token.
  3. This tool’s select! branch fires, the Command is dropped, kill_on_drop(true) reaps the child, and ToolOutcome:: Cancelled flows 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§

ExecuteCommandTool
execute_command — spawn a shell, run a command, capture output.