Skip to content

Commit 7a6f65a

Browse files
committed
fix: tmux missing exception
1 parent bd7649c commit 7a6f65a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
75 Bytes
Binary file not shown.

ssh.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
from BaseServer import BaseServer
66
import subprocess
7+
import shutil
78

89
# 环境变量
910
os.environ["PATH"] = "/usr/local/bin:/opt/homebrew/bin:" + os.environ.get("PATH", "")
@@ -67,6 +68,10 @@ def run(self, methodName, *args, **kwargs):
6768
method = getattr(self, methodName, None)
6869
if method and callable(method):
6970
name, result = method(*args, **kwargs)
71+
if not shutil.which("tmux"):
72+
# 如果没有 tmux,退回到基础输出或执行备选逻辑
73+
print(result, end='')
74+
return
7075
if TMUX_SESSION_NAME and (methodName == "getByIndex" or methodName == "add"):
7176
name = name.replace(".", "_")
7277
# check tmux session exist

0 commit comments

Comments
 (0)