From 75c0fe0e03f219c192dc336788b885995601d1c1 Mon Sep 17 00:00:00 2001 From: Zhang Jiajun Date: Thu, 10 May 2018 19:19:11 +0800 Subject: [PATCH] [REV] Optimize to execute multiple commands. --- builder/exector/export_app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/exector/export_app.go b/builder/exector/export_app.go index 27c49e696..0e301ca79 100644 --- a/builder/exector/export_app.go +++ b/builder/exector/export_app.go @@ -475,7 +475,7 @@ func (i *ExportApp) generateTarFile() error { // /grdata/export-app/myapp-1.0 -> myapp-1.0 baseName := path.Base(i.SourceDir) // 打包整个目录为tar包 - err := exec.Command(fmt.Sprintf("cd %s ; rm -rf %s.tar ; tar -cf %s.tar %s", dirName, baseName, baseName, baseName)).Run() + err := exec.Command(fmt.Sprintf("{ cd %s ; rm -rf %s.tar ; tar -cf %s.tar %s ; }", dirName, baseName, baseName, baseName)).Run() if err != nil { i.Logger.Error("打包应用失败", map[string]string{"step": "export-app", "status": "failure"}) logrus.Errorf("Failed to create tar file for group key %s: %v", i.GroupKey, err)