Skip to content

pane_wait_for_output

Asynchronously wait until pane output matches the requested pattern or the timeout expires.

Wait until pane output satisfies a match expression.

Parameters:

Name Type Description Default
pane_id str

Target pane identifier.

required
match OutputMatch

Schema-defined text or pattern match object.

required
source ReadSource

Output source to inspect.

'recent'
lines int | None

Optional maximum number of lines to inspect.

None
timeout_ms int | None

Server-side wait timeout in milliseconds.

None
strip_ansi bool

Remove ANSI escape sequences before matching.

True

Returns:

Type Description
OutputMatchedResult

The matched output and match metadata.

Example
client = AsyncHerdrClient()
result = await client.pane_wait_for_output(
    "build",
    match={"type": "substring", "value": "ready"},
    timeout_ms=5_000,
)
print(result["matched"])
Source code in src/herdr_client/async_client/client.py
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
async def pane_wait_for_output(
    self,
    pane_id: str,
    match: OutputMatch,
    source: ReadSource = "recent",
    lines: int | None = None,
    timeout_ms: int | None = None,
    strip_ansi: bool = True,
) -> OutputMatchedResult:
    """Wait until pane output satisfies a match expression.

    Args:
        pane_id: Target pane identifier.
        match: Schema-defined text or pattern match object.
        source: Output source to inspect.
        lines: Optional maximum number of lines to inspect.
        timeout_ms: Server-side wait timeout in milliseconds.
        strip_ansi: Remove ANSI escape sequences before matching.

    Returns:
        The matched output and match metadata.

    Example:
        ```python
        client = AsyncHerdrClient()
        result = await client.pane_wait_for_output(
            "build",
            match={"type": "substring", "value": "ready"},
            timeout_ms=5_000,
        )
        print(result["matched"])
        ```
    """
    params: PaneWaitForOutputParams = {
        "pane_id": pane_id,
        "source": source,
        "match": match,
        "strip_ansi": strip_ansi,
    }
    if lines is not None:
        params["lines"] = lines
    if timeout_ms is not None:
        params["timeout_ms"] = timeout_ms
    return await self.request("pane.wait_for_output", params)