From d11dbbccb78b2c02ed75170b5d692125f6bc3c5b Mon Sep 17 00:00:00 2001 From: dami Date: Sat, 24 May 2025 01:03:08 +0800 Subject: [PATCH] Update ssh_local.py --- web/utils/ssh/ssh_local.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/web/utils/ssh/ssh_local.py b/web/utils/ssh/ssh_local.py index a7edfad54..130e29a7f 100644 --- a/web/utils/ssh/ssh_local.py +++ b/web/utils/ssh/ssh_local.py @@ -117,14 +117,17 @@ class ssh_local(object): if not self.__ssh: self.__ssh = self.connectSsh() - if hasattr(self.__ssh, 'exit_status_ready'): - if self.__ssh.exit_status_ready(): - self.__ssh = self.connectSsh() + if self.__ssh: + if hasattr(self.__ssh, 'exit_status_ready'): + if self.__ssh.exit_status_ready(): + self.__ssh = self.connectSsh() - self.__ssh.send(info) - try: - time.sleep(0.005) - recv = self.__ssh.recv(8192) - return self.wsSend(recv) - except Exception as ex: - return self.wsSend('') + self.__ssh.send(info) + try: + time.sleep(0.005) + recv = self.__ssh.recv(8192) + return self.wsSend(recv) + except Exception as ex: + return self.wsSend('') + else: + return self.wsSend('连接中...') \ No newline at end of file