From 468e14bd34af791676eac8b5e1a90c46282eadeb Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期六, 30 五月 2020 17:21:44 +0800
Subject: [PATCH] fix unTarGz .tar.gz
---
extend/util/zip.go | 6 ++++++
service/SdkInstall.go | 3 ++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/extend/util/zip.go b/extend/util/zip.go
index 3e17773..592a48a 100644
--- a/extend/util/zip.go
+++ b/extend/util/zip.go
@@ -281,6 +281,12 @@
return nil
}
+func UnTarGzByCmd(srcFile string, dstPath string) (string,error) {
+ cmd := exec.Command("tar -zxvf", srcFile, "-C", dstPath)
+ outPut, err := cmd.Output()
+ return string(outPut), err
+}
+
// 鍥犱负瑕佸湪 defer 涓叧闂枃浠讹紝鎵�浠ヨ鍗曠嫭鍒涘缓涓�涓嚱鏁�
func unTarFile(dstFile string, tr *tar.Reader) error {
// 鍒涘缓绌烘枃浠讹紝鍑嗗鍐欏叆瑙e寘鍚庣殑鏁版嵁
diff --git a/service/SdkInstall.go b/service/SdkInstall.go
index 66fcace..e759454 100644
--- a/service/SdkInstall.go
+++ b/service/SdkInstall.go
@@ -68,7 +68,8 @@
}
unPackFilePath := configPatchPath+"/"+identifier+ext
- err := util.UnTarGz(unPackFilePath, unPackPath)
+ logger.Debug("unPackFilePath:", unPackFilePath, "unPackPath:", unPackPath)
+ _,err := util.UnTarGzByCmd(unPackFilePath, unPackPath)
if err !=nil {
logger.Debug("UnPack err:",err,"unPackFile:",unPackFilePath)
return false, err
--
Gitblit v1.8.0