Repository navigation
libtmux 0.68.0 raises TmuxObjectDoesNotExist when a pane, window or session has closed, instead of returning [] from Pane.capture_pane() or None from Pane.send_keys(). Server.run_shell() raises VersionTooLow on tmux 3.3a and 3.4 rather than returning [] when tmux leaves the output in copy mode, Session.new_window() with select_existing=True reuses an existing window by index or target on every tmux, and expand_formats is the one parameter name for tmux's -F.
Highlights
- Closed panes, windows and sessions raise
TmuxObjectDoesNotExist.Pane.capture_pane()andPane.send_keys()previously returned[]andNonewhen their pane had closed, and methods that already raised for a missing session, window or pane raised the baseLibTmuxException. They now raiseTmuxObjectDoesNotExist, aLibTmuxExceptionsubclass soexcept LibTmuxExceptionstill matches.send_keys()andPane.enter()also raiseLibTmuxExceptionon other tmux errors (#902). run_shell()raisesVersionTooLowon tmux 3.3a and 3.4 instead of returning[]. On tmux 3.3a and 3.4, a foregroundrun-shellleaves its output in copy mode and sends nothing back to the caller.Server.run_shell()now raisesVersionTooLowthere; calls withbackground=True,as_tmux_command=Trueortarget_pane=run as before (#918).select_existing=Truereuses by index or target on every tmux.Session.new_window()looks up the window atwindow_indexortarget_windowitself instead of sendingnew-window -S, so reuse returns the existingWindowinstead of raisingIndexErroror failing with"index in use"on tmux 3.3a through 3.7. Passingwindow_namealongside an index or window ID raisesLibTmuxExceptionwhen the window there has another name, and combiningselect_existing=Truewithkill_existing=TrueraisesValueError(#827). Enteringwithon a reusedWindowstill kills it on exit (#926; see Context managers), andFormat("#{command}")never matches an existing window because the lookup expands it withdisplay-messagewhile tmux names the windownew-window(#921; see Literal text and tmux formats).expand_formatsis the one name for tmux's-F.Session.set_environment(),Server.command_prompt()andSession.set_option()(along with server, window and paneset_option()) takeexpand_formats, the same namePane.send_keys()uses.expand_formatand_formatstill work and emitDeprecationWarning(#919).
To handle panes that may close before capture:
from libtmux import exc
try:
lines = pane.capture_pane()
except exc.TmuxObjectDoesNotExist:
lines = []See the migration notes and the changelog for the full list.
What's Changed
- Session(docs[new_window]): Note the #{command} lookup limit by @tony in #921
- tests(Session,Window): Wait for the shell before reading env output by @tony in #922
- libtmux(feat[expand_formats]): One name for -F by @tony in #919
- Server(fix[run_shell]): Refuse output tmux keeps by @tony in #918
- Session(fix[new_window]): Reuse by index or target on every tmux by @tony in #827
- tmux(fix[errors]): Raise TmuxObjectDoesNotExist for a closed target by @tony in #902
- Session(docs[new_window]): Note
Window.__exit__onselect_existingreuse by @tony in #926
Full Changelog: v0.67.1...v0.68.0