From 0e124e76fadfba9c8995cc0f881b88be2619f261 Mon Sep 17 00:00:00 2001 From: xc Date: Thu, 9 Oct 2025 16:51:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=B0=83=E7=94=A8=E5=A4=96?= =?UTF-8?q?=E9=83=A8=E7=A8=8B=E5=BA=8F=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scagent/core/FileRpc.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scagent/core/FileRpc.go b/scagent/core/FileRpc.go index ddf84b4..ccd8926 100644 --- a/scagent/core/FileRpc.go +++ b/scagent/core/FileRpc.go @@ -93,14 +93,16 @@ func clientUploadFile(remote string, filePath string, uploadPath string) { // 调用外部组件scalib 程序执行 // ./scalib -h 192.168.66.92:9098 -f /www/gfs/sync_zips/BIU_20251009_153640.zip -u /www/afs/logs/ // 执行命令 - cmd := fmt.Sprintf("scalib -h %s -f %s -u %s", remote, filePath, uploadPath) - fmt.Printf("cmd: %s\n", cmd) + cmd := fmt.Sprintf("./scalib -h %s -f %s -u %s", remote, filePath, uploadPath) // 执行系统命令 - err := exec.Command(cmd).Run() + exec.Command(cmd) + out, err := exec.Command("sh", "-c", cmd).CombinedOutput() + if err != nil { logger.Error("ExecCommand failed", zap.Error(err)) fmt.Printf("ExecCommand failed: %v\n", err) return } + fmt.Printf("out: %s\n", out) }