Core LibraryAPI Reference

Choose documentation 2

latest

Current version

latest
English

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

cmdlet libtmux-powershell latest

LibTmux.Wait-TmuxChannel

LibTmux\Wait-TmuxChannel LibTmux\Wait-TmuxChannel

Wait for a tmux channel signal with a timeout and owned withdrawal.

Source and package
Declared in
LibTmux
Package
LibTmux
Source
src/LibTmux.PowerShell/WaitTmuxChannelCommand.cs

Description#

Wait on the supplied native server and emit True after observing a channel signal. A pending signal from before the call also completes the wait. An empty owner pipeline performs no work and emits no output.

Use one open waiter per channel and give each operation a unique channel. tmux has no individual waiter deregistration: withdrawing signals the channel and wakes every waiter registered there. This command owns and disposes its wait, including on timeout or pipeline cancellation, so an abandoned client cannot consume a later signal. The borrowed server remains running.

The timeout bounds the wait attempt. Withdrawal is awaited before returning; cleanup time is additional. A signal racing withdrawal can leave the channel pending for a later caller. Do not infer that no signal arrived from a timeout, and do not reuse a channel to identify a different operation.

Notes

Tmux.ChannelWaitFailed retains the native server as its target. Timeout uses TimeoutException with the OperationTimeout category and emits no success object. ErrorAction Continue permits later owners to run; ErrorAction Stop terminates on failure. Ctrl+C cancels the attempt and withdraws the waiter before the pipeline stops. Cancellation cannot undo work in the producer. Invalid channels and timeouts fail before contacting tmux.

Command details#

Command type
cmdlet
Positional binding
Enabled.
Pipeline inputs
LibTmux.Server : The native server to wait on.
Outputs
System.Boolean

Examples#

Example 1 Use a previously selected native $server and reserve build-finished for one waiter. Have the producer run tmux wait-for -S build-finished on that server after its work completes. The producer may signal before this command starts. View source

Terminal window
$server | LibTmux\Wait-TmuxChannel -Channel 'build-finished' -Timeout 10
Parameters
  • -Server (LibTmux.Server) #

    The native server endpoint that owns the channel.

    Required
    Yes
    Position
    0
    Pipeline input
    By value
    Validation
    ValidateNotNull()
  • -Channel (System.String) #

    The nonempty, non-whitespace channel reserved for this operation. NUL is rejected.

    Required
    Yes
    Position
    1
    Pipeline input
    No
    Validation
    ValidateNotNullOrEmpty()
  • -Timeout (System.Double) #

    The wait budget in seconds. Fractions are accepted. The default is 10; the valid range is 0.0000001 through 86400. NaN and infinity are rejected.

    Required
    No
    Position
    Named
    Pipeline input
    No
    Default
    10
Common parameters 12

PowerShell supplies these parameters. See common parameter behavior for their effects.

Returns

System.Boolean : True after observing a signal. Timeout emits an error, not False.

Discussed in Send input to a pane

Esc

Type to search.

Reference preview Open reference