Skip to content

Commit f657e4c

Browse files
committed
docs(CHANGES): Bounded tmux commands
what: - Record the `timeout` parameter on `wait_for` and the `cmd` chain, and the `TmuxCommandTimeout` it raises, under `What's new`.
1 parent 6027660 commit f657e4c

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

CHANGES

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,29 @@ $ uvx --from 'libtmux' --prerelease allow python
4545
_Notes on the upcoming release will go here._
4646
<!-- END PLACEHOLDER - ADD NEW CHANGELOG ENTRIES BELOW THIS LINE -->
4747

48+
### What's new
49+
50+
#### Bounded tmux commands (#732)
51+
52+
{meth}`Server.wait_for() <libtmux.Server.wait_for>` takes a `timeout` in seconds.
53+
A tmux channel is a rendezvous with no clock on it: when the pane that was going
54+
to signal is killed, exits early, or has its window closed, the waiter blocks for
55+
the life of the process. `server.wait_for(channel, timeout=60)` turns that into
56+
a {exc}`~libtmux.exc.TmuxCommandTimeout` you can catch. It subclasses
57+
{exc}`~libtmux.exc.WaitTimeout`, so existing handlers keep working, and it
58+
carries the command that was killed and the bound it exceeded.
59+
60+
The bound is available to any tmux command, not just `wait-for`.
61+
{meth}`Server.cmd() <libtmux.Server.cmd>`,
62+
{meth}`Session.cmd() <libtmux.Session.cmd>`,
63+
{meth}`Window.cmd() <libtmux.Window.cmd>`,
64+
{meth}`Pane.cmd() <libtmux.Pane.cmd>`, and
65+
{class}`~libtmux.common.tmux_cmd` beneath them all accept `timeout`, and all
66+
kill and reap the tmux process before raising, so an expiry leaves nothing
67+
behind. The default, `None`, waits as long as tmux takes.
68+
69+
See {ref}`automation-patterns` for waiting on a channel instead of polling.
70+
4871
### Documentation
4972

5073
#### Automation patterns waits for tmux instead of guessing (#NN)

0 commit comments

Comments
 (0)