Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/libtmux/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,12 @@ def has_minimum_version(raises: bool = True) -> bool:
Versions will now remove trailing letters per
`Issue 55 <https://github.com/tmux-python/tmuxp/issues/55>`_.
"""
if get_version() < LooseVersion(TMUX_MIN_VERSION):
current_version = get_version()
if current_version < LooseVersion(TMUX_MIN_VERSION):
if raises:
msg = (
f"libtmux only supports tmux {TMUX_MIN_VERSION} and greater. This "
f"system has {get_version()} installed. Upgrade your tmux to use "
f"system has {current_version} installed. Upgrade your tmux to use "
"libtmux, or use libtmux v0.48.x for older tmux versions."
)
raise exc.VersionTooLow(msg)
Expand Down
14 changes: 13 additions & 1 deletion src/libtmux/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ def is_alive(self) -> bool:
def raise_if_dead(self) -> None:
"""Raise if server not connected.

Raises
------
:exc:`exc.TmuxCommandNotFound`
When the tmux binary cannot be found or executed.
:class:`subprocess.CalledProcessError`
When the tmux server is not running (non-zero exit from
``list-sessions``).

>>> tmux = Server(socket_name="no_exist")
>>> try:
... tmux.raise_if_dead()
Expand All @@ -232,7 +240,11 @@ def raise_if_dead(self) -> None:
if self.config_file:
cmd_args.insert(0, f"-f{self.config_file}")

subprocess.check_call([tmux_bin, *cmd_args])
subprocess.check_call(
[tmux_bin, *cmd_args],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)

#
# Command
Expand Down