File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -118,16 +118,27 @@ def __init__(
118118 self .colors = colors
119119
120120 def is_alive (self ) -> bool :
121+ """If server alive or not.
122+
123+ >>> tmux = Server(socket_name="no_exist")
124+ >>> assert not tmux.is_alive()
125+ """
121126 try :
122127 res = self .cmd ("list-sessions" )
123- print (f"returncode: { res .returncode } " )
124- print (f"stdout: { res .stdout } " )
125- print (f"stderr: { res .stderr } " )
126128 return res .returncode == 0
127129 except Exception :
128130 return False
129131
130132 def raise_if_dead (self ) -> None :
133+ """Raise if server not connected.
134+
135+ >>> tmux = Server(socket_name="no_exist")
136+ >>> try:
137+ ... tmux.raise_if_dead()
138+ ... except Exception as e:
139+ ... print(type(e))
140+ <class 'subprocess.CalledProcessError'>
141+ """
131142 tmux_bin = shutil .which ("tmux" )
132143 if tmux_bin is None :
133144 raise exc .TmuxCommandNotFound ()
You can’t perform that action at this time.
0 commit comments