diff --git a/src/libtmux/common.py b/src/libtmux/common.py index a84068042..bc9140b24 100644 --- a/src/libtmux/common.py +++ b/src/libtmux/common.py @@ -456,11 +456,12 @@ def has_minimum_version(raises: bool = True) -> bool: Versions will now remove trailing letters per `Issue 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) diff --git a/src/libtmux/server.py b/src/libtmux/server.py index 68881b158..181e5223c 100644 --- a/src/libtmux/server.py +++ b/src/libtmux/server.py @@ -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() @@ -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