From 5bac221cdf7080bc43b85bf43a535325494a59e3 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Mon, 20 Jan 2025 17:16:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20SSH=E5=B7=A5=E5=85=B7=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E6=96=87=E4=BB=B6=E5=A4=B9=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/utils/ssh/files.go | 2 +- src/framework/utils/ssh/sftp.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/framework/utils/ssh/files.go b/src/framework/utils/ssh/files.go index 187d9c86..d38a62d5 100644 --- a/src/framework/utils/ssh/files.go +++ b/src/framework/utils/ssh/files.go @@ -41,7 +41,7 @@ func FileList(sshClient *ConnSSH, path, search string) ([]FileListRow, error) { // 是否远程客户端读取 if sshClient == nil { - resultStr, err := cmd.Execf(cmdStr) + resultStr, err := cmd.Exec(cmdStr) if err != nil { logger.Errorf("Ne FileList Path: %s, Search: %s, Error:%s", path, search, err.Error()) return rows, err diff --git a/src/framework/utils/ssh/sftp.go b/src/framework/utils/ssh/sftp.go index 45ef9af6..e2a0d3cf 100644 --- a/src/framework/utils/ssh/sftp.go +++ b/src/framework/utils/ssh/sftp.go @@ -135,10 +135,10 @@ func (s *SSHClientSFTP) CopyFileLocalToRemote(localPath, remotePath string) erro defer localFile.Close() // 创建远程目录 - // if err := s.Client.MkdirAll(filepath.Dir(remotePath)); err != nil { - // logger.Errorf("CopyFileLocalToRemote failed to creating remote directory %s: => %s", remotePath, err.Error()) - // return err - // } + if err := s.Client.MkdirAll(filepath.Dir(remotePath)); err != nil { + logger.Errorf("CopyFileLocalToRemote failed to creating remote directory %s: => %s", remotePath, err.Error()) + return err + } // 创建远程文件 remoteFile, err := s.Client.Create(remotePath)