Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Swift API

Swift documentation

Server.waitForOutput(in:matching:stoppingAt:requiringFreshOutput:startingAt:timeout:tailLimit:)

Swift
  • Python Unavailable
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust Unavailable
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift

View as Markdown

Declared in
Server
Package
libtmux-swift
Source
Sources/LibTmux/WaitForOutput.swift
waitForOutput(in:matching:stoppingAt:requiringFreshOutput:startingAt:timeout:tailLimit:) ( in : Pane , matching : [RegexPattern] , stoppingAt : [RegexPattern] , requiringFreshOutput : Bool , startingAt : CaptureCursor? , timeout : Duration , tailLimit : Int ) → OutputWait
methodasync [source]
methodasync [source]
waitForOutput(in:matching:stoppingAt:requiringFreshOutput:startingAt:timeout:tailLimit:)

Waits until a pane prints something, driven by tmux output events.

tmux has no hook that fires on pane output, so a wait that only has commands to work with must re-read the pane on a timer. A control connection is told instead: %output arrives as the pane writes.

What arrives there is raw terminal bytes — keystroke echo, escape sequences, a word split across two notifications — so it is used as a doorbell rather than as text. Each burst wakes one capture, and the matching runs against the rendered grid, which is the same text a person reads. That keeps the accuracy of a capture and pays for it only when something actually happened. A small liveness probe runs while the pane is quiet so removing it ends the wait instead of looking like a timeout.

The conditions are checked before they are blocked on. A match or stop already on screen returns at once, with OutputWait/matchedAtEntry set. Pass requiringFreshOutput when only a new occurrence counts.

  • Parameters:
    • pane: the pane to watch.
    • patterns: bounded regular expressions, any of which ends the wait. Empty means any new output at all does — the right choice when what the pane prints is not known in advance.
    • stops: bounded regular expressions that end the wait as OutputWait/Outcome/stopped. A failure marker belongs here: a build that fails at five seconds should not hold the wait open for the rest of the timeout.
    • requireFresh: only count output that arrives after this call, so a match already on screen is waited past rather than returned.
    • cursor: where an earlier incremental capture or wait stopped. Rows after it are checked before waiting for more output.
    • timeout: how long to wait before giving up.
    • tailLimit: how many trailing lines to report back.

Discussed in Capture pane output · Pane interaction

0 declared, 0 inherited

Esc

Type to search.