From 15cca2c2979455e33dffabe67e9b34b5c22b39f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A0=E7=A3=8A?= Date: Thu, 1 Aug 2024 15:40:32 +0800 Subject: [PATCH] test --- common/ssh_client/remote_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/ssh_client/remote_client.py b/common/ssh_client/remote_client.py index 5516324a..311aa785 100644 --- a/common/ssh_client/remote_client.py +++ b/common/ssh_client/remote_client.py @@ -84,7 +84,8 @@ def exec_cmd(self, cmd): self.stdio.verbose("use remote_client_sudo") stdin, stdout, stderr = self._ssh_fd.exec_command("sudo -n true") if stderr: - raise Exception(stderr.read().decode('utf-8')) + if len(stderr.read().decode('utf-8').strip())> 0: + raise Exception(stderr.read().decode('utf-8')) cmd = "sudo {0}".format(cmd) stdin, stdout, stderr = self._ssh_fd.exec_command(cmd) err_text = stderr.read()