it2 shell wait-for-prompt

Wait until shell prompt appears

Synopsis

it2 shell wait-for-prompt [<session-id>] [flags]

Description

Block until the shell prompt appears, indicating the shell is ready for input.

If no session-id is provided, uses $ITERM_SESSION_ID environment variable.

This command subscribes to NOTIFY_ON_PROMPT notifications and waits for the
shell to reach the EDITING state (at prompt, ready for input). If the shell
is already at a prompt, returns immediately.

Requires Shell Integration to be enabled in iTerm2.

The command will exit with:
0 - Shell prompt appeared (success)
1 - Timeout exceeded before prompt appeared

Use this command to ensure reliable command sequencing in automation scripts.

Options

-q, --quiet
Quiet mode - no output

--timeout (default "30s")

Maximum time to wait for prompt

Options inherited from parent commands

--format (default "text")

Output format (text, json, yaml) - affects how command results are displayed

--url

WebSocket URL for iTerm2 API - typically ws://localhost:1912 for local iTerm2

See Also

  • it2 shell - Shell state detection and prompt tracking

Examples

# Wait for shell before sending next command
$ it2 shell wait-for-prompt
$ it2 session send-text "next command"

# Wait with custom timeout
$ it2 shell wait-for-prompt --timeout 60s

# Wait for specific session
$ it2 shell wait-for-prompt w0t1p0:ABC123-DEF456

# Automation example
$ it2 session send-text "make build"
$ it2 shell wait-for-prompt --timeout 5m
$ it2 session send-text "make test"