exec_expect
Execute shell, REPL, or bootloader commands and automatically wait for the prompt, returning structured results with output, exit code, and timeout.
Instructions
Execute a shell, REPL, or bootloader command and automatically wait for prompt to return. Output preserves original terminal stream (including command echo) as a causal anchor for AI analysis. ANSI escape codes are stripped for readability.
Returns a structured result with 'success', 'output', 'timeout', 'process_exited', 'exit_code', and 'elapsed_seconds' fields.
IMPORTANT: For long-running commands (e.g. apt-get install, make, large file transfers), use send instead to dispatch the command, then poll with read_buffer periodically to check progress. Do NOT use exec_expect for commands that may take more than a few seconds, as it will report a timeout.
Args: command: The command line to execute. prompts: Optional list of prompt patterns (defaults to standard shell and REPL prompts). timeout: Maximum seconds to wait for the prompt to return. session_id: Target session ID (defaults to currently active session).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | ||
| prompts | No | ||
| timeout | No | ||
| session_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||